- Configuration module with dotenv package.
- Route module for centralization of all application routes.
- Logger module inclunding support for external log server.
(In order to exemplify this project use Papertrail ). - Messages module for message strings centralization
- Configuration to running in production using PM2.
- Authentication support using JWT.
- Base controller with CRUD operations for extension having the following features:
- Query filter using query params
- Pagination support
- Soft delete support
- Validation support
- Database integration and Object Modeling Tool using mongoose.
- CORS enabled.
- Request validation using express-validator
- Better messages for mongoose unique and required validations.
- Migrations for easy database changes tracking and syncing across all develop team.
- Included CI (Continuous Integration) with Travis CI.
- Testing with Mocha and Chai.
- Lint using Eslint.
- Configuration for consistent coding styles across various editors and IDEs using EditorConfig.
Create a .env
file using .env.example
as template. Setup the following variables:
- NODE_ENV : Application execution enviroment
- PORT : Server port
- MONGO_URI : Connection URI for MongoDB
- MIGRATE_dbConnectionUri : Connection URI for store migrate plugin metadata
- JWT_SECRET : Secret for encrypt / decrypt jwt token
- LOGGER_HOST : Host for external logging server
- LOGGER_PORT : Port for external logging server
This project comes with a some npm scripts. You can run them with npm run <script name>
:
start
: Run the application in development modewatch
: Run the application in development mode watching for file changeslint
: Run eslint pluginfix
: Run eslint plugin and try to automatically fix problemsmigrate
: Shortcut to run migration tool installed in node_modules foldertest
: Set the enviroment variable and run mocha test cases
The test cases examples can be found on test folder. There is an unit test for a generic AppError class, and integration tests for /auth
and /user
endpoints.
This project comes with a basic PM2 configuration file called process.json
, for PM2 use you could run the following command:
pm2 start process.json