- NodeJS (Typescript), Express
- MongoDB, Mongoose ODM
- Swagger for API doc
- Jest for unit testing and integration testing
- Docker configuration
- Send email using Nodemailer and Handlebars
- Validation schema, rules using Joi
- File upload using Multer and Sharp
- JWT authentication using Passport
- Create env files and set env vars as necessary (eg. DB_CON_STR)
- Copy .env.test.local to .env.local.
- Copy .env.test.production to .env.production
- Run
npm installcommand - To run project locally using nodemon:
npm run dev - To run all unit and integration tests in watch mode:
npm run test:watch - To run only unit tests:
npm run test:unit - To run only integration tests:
npm run test:int
-
Dev mode:
docker-compose --env-file .env.local up -d -
Production mode:
docker-compose --env-file .env.production up -d
Services are defined in docker-compose.yml file, which retrieves dynamic vars eg. ENVIRONMENT, DOCKER_FILENAME, PORT from the respective env files.
Dockerfile uses multi-stage build:
-
Stage 1: Install dependencies and dev depencies, run unit & integration tests and finally create a build (TS converted to JS).
-
Stage 2: Install only the required dependencies (not dev dependencies) and copy build code generated in previous stage. Finally start the application using npm start command.