This is a starter Express.js1 API Template, helping to get past the routine of starting a new project from scratch again and again!
This template is still in WIP phase!
First install the dependencies:
npm iBuild the project. (Using TypeScript5)
npm run buildWatch for changes and rebuild automatically.
npm run build:watchTest the project. (Using Jest6)
npm testTest with code coverage report.
npm run test:coverageTest in ci.
npm run test:ciCheck for code style issues in the project. (Using ESLint7)
npm run lintFix code style issues in the project.
npm run lint:fixGenerate the API documents to be served statically. (Using Swagger8)
npm run docs:swaggerGenerate & serve the API documents. (The documents' server address will be printed in the terminal)
npm run docs:apiGenerate the Code documents to be served statically. (Using TypeDoc9)
npm run docs:codeAfter running this command, open docs/code/index.html in your preferred browser.
First create the .env file:
cp .env.example .env| Name | Type | Default | Description |
|---|---|---|---|
NODE_ENV |
production,development,test |
development |
Node.js3 environment (test will be provided by the testing framework automatically) |
RELEASE_ENV |
production,staging |
staging |
Release environment |
| Name | Type | Default | Description |
|---|---|---|---|
SERVER_HOSTNAME |
string | localhost |
Express.js1 server hostname |
SERVER_PORT |
integer | 3000 |
Express.js1 server port |
| Name | Type | Default | Description |
|---|---|---|---|
DATABASE_URI |
string | - | MongoDB4 connection string uri |
| Name | Type | Default | Description |
|---|---|---|---|
SENTRY_DSN |
string | - | Sentry10 project DSN value |
Start the API.
npm startWatch for changes and restart automatically.
npm run start:watchStart the services:
docker-compose up -d --build --remove-orphansStop the services:
docker-compose down.
├── __tests__ # Test files
│ ├── controllers # Express.js controller tests
│ └── jest # Test utilities
├── docs # Static documents
│ ├── api # API documents
│ └── code # Code documents
├── scripts # Project scripts
└── src # Source files
├── config # Configuration values
├── constants # Constants
├── controllers # Express.js controllers
├── lib # Libraries
└── models # Database models
We use SemVer11 for versioning. For the versions & changelogs available, see the releases on this repository.