AugustoMarcelo / nodejs-starter-project

πŸ“¦ Node.js project with some preconfigured libraries and design patterns...

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

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

⬇ Cloning project

  git clone https://github.com/augustomarcelo/nodejs-starter-project your-project-name

  # Download dependencies
  yarn

πŸ” Generate pair keys

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.

🎲 Create ormconfig.json

You can rename the file ormconfig.example.js and fill in the fields with your data

⌨ Commands

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

About

πŸ“¦ Node.js project with some preconfigured libraries and design patterns...


Languages

Language:TypeScript 93.5%Language:JavaScript 6.4%Language:Shell 0.1%