https://github.com/CaioQueirozIFCE/boilerplate-api-node-js.git .
With the cloned project, run yarn install to install all dependencies listed in package.json.
- Docker support
- Logging: using winston and morgan
- Error handling: centralized error handling mechanism
- Dependency management: with Yarn
- Environment variables: using dotenv and cross-env
- CORS: Cross-Origin Resource-Sharing enabled using cors
- Linting: with ESLint and Prettier
- Editor config: consistent editor configuration using EditorConfig
yarn dev:server
yarn build
# run docker container in development mode
yarn docker:dev
# run docker container in production mode
yarn docker:prod
src\
|--app\ # Layer related to project infrastructure
|--container\ # File to generate injectables (dependency injections): tsyringe
|--errors\ # Class for managing global errors
|--http # Infrastructure layer related to http protocol
|--middlewares # Custom express middlewares
|--server.ts # Express app
|--routes\ # Routes
|--utils\ # Utility classes and functions
|--validates.ts # Utility functions that help in project structure
|--debugfiles\ # debug utility
|--config\ # Environment variables and configuration related things
|--logs\ # Application log files
The environment variables can be found and modified in the .env
file. They come with these default values:
#Name App
APP_NAME=boilerplate-node
# Port number
APP_PORT=3333
#Jwt key's
JWT_SECRET=
EXPIRESINJWT=
#Bcrypt key's
HASH_PASSWORD=
HASH_REQUEST=
# SMTP configuration options for the email service
MAIL_MAILER=
MAIL_HOST=
MAIL_PORT=
MAIL_USERNAME=
MAIL_PASSWORD=
MAIL_ENCRYPTION=
MAIL_FROM_ADDRESS=
MAIL_FROM_NAME=
The MIT License (MIT)
Copyright © 2021 Caio Queiroz