This is a Node.js project with some preconfigured libraries and design patterns like:
- DDD
- Tests with Jest
- Dependency Injection
- Repository Pattern
- Typeorm with PostgreSQL
- Authentication with JWT
- Build libs preconfigured
- Environment variables
- Routes validation with Celebrate
- Typescript
- Eslint, Prettier
git clone https://github.com/augustomarcelo/nodejs-starter-project your-project-name
# Download dependencies
yarn
For JWT implementation, I recommend generating a public and private key pair.
# Generate private key
ssh-keygen -t rsa -b 4096 -m PEM -f jwtRS256.key
# Generate public key
ssh-keygen -e -m PEM -f jwtRS256.key > jwtRS256.key.pub
Reference: https://gist.github.com/ygotthilf/baa58da5c3dd1f69fae9#gistcomment-2855422
After generating the keys, create an .env
file (or rename the .env.example
) and fill it out.
You can rename the file ormconfig.example.js
and fill in the fields with your data
Descrtion | Command |
---|---|
Run application | yarn dev:server |
Build | yarn build |
Run tests and watch | yarn test |
Run coverage tests | yarn test:ci |
Run tests staged | yarn test:staged |
Create migrations | yarn typeorm migration:create -n MigrationName |
Run migrations | yarn typeorm migration:run |
Revert migrations | yarn typeorm migration:revert |