Skip to content

Commit

Permalink
Merge pull request #2 from tuanlc/keep-project-up-to-date
Browse files Browse the repository at this point in the history
Update documentation
Upgrade dependencies
  • Loading branch information
tuanlc authored Oct 7, 2023
2 parents 9f929f4 + 450f682 commit 3bf5ca2
Show file tree
Hide file tree
Showing 4 changed files with 3,062 additions and 14 deletions.
2 changes: 0 additions & 2 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,6 @@ npm-debug.log
dist
build
.idea
package-lock.json
yarn.lock
yarn-error.log
.env
.env.local
Expand Down
39 changes: 35 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
This boilerplate follows clean architecture with SOLID principles. This sample define a simple user schema and handle two endpoints that allows users to create new accounts and login by them. There is also a middleware to validate JWT tokens that are provided by clients with `Bearer` authorization header.

## Technologies

- Environment: Nodejs
- Language: Typescript
- Framework: Expressjs
Expand All @@ -13,41 +14,71 @@ This boilerplate follows clean architecture with SOLID principles. This sample d
- Password hash library: bcryptjs

## Prequisite

- Create the `.env` file by copying the `.env.example` file
- Database:
- Database:

- The easy way to have a Postgresql server is using docker or you can use Postgreql cloud
- Once you have the database connection URL, replace the sample one in the `.env` file by yours

- Run Postgres database at port 5432

```bash
docker run -e POSTGRES_PASSWORD=secrect -e POSTGRES_USER=postgres -p 5432:5432 postgres:15-alpine
```

- Create `.env` file from `.env.template` and update the `DATABASE_URL`:

```bash
cp .env.template .env
```

- Edit file `.env`

```
DATABASE_URL="postgresql://postgres:secrect@localhost:5432/prisma-posgres-boilerplate?schema=public"
```

- Install dependencies

```bash
npm install
npm ci
```

- Initialize database schema

```bash
npx prisma migrate dev --name "init" --preview-feature
```

## Docker build

```bash
docker build -t app-name .
```

## NPM scripts

1. Run dev

```bash
npm run dev
```

2. Linting

```bash
npm run lint
```

3. Build
3. Build

```bash
npm run build
```

4. Run production

```bash
npm run start
```
```
Loading

0 comments on commit 3bf5ca2

Please sign in to comment.