Default branch :
- using postgres database and sequelize orm
More Feature Checkout the branch :
-
main
using postgres and mongodb database as a default branch -
feature/elastic
using database elastic -
feature/grpc
using grpc -
feature/graphql
using graphql
This project has 3 Domain layer :
- Repository Layer
- Usecase Layer
- Transport Layer
you must click the button use this template
- using template - create name of your repository
- rename link readme - change link repo default
github/firmanJS/express-template-typescript
to your repo - codeclimate - you must integrate repo to codeclimate don't forget set your repo is public for integrated and in github repo settings create secret key with name
CC_TEST_REPORTER_ID
and value from code climateREPORTER ID
in https://codeclimate.com/
or clone this repository via https :
https://github.com/firmanJS/express-template-typescript.git
- Node.js - http://nodejs.org/
- Typescript - https://www.typescriptlang.org/
- Express - http://expressjs.com/
-
- error handling
-
- clean architecture folder
-
- testing with jest
-
- coverage use jest
-
- with docker example
-
- validiation, use express-valdator
-
- pagination example
-
- custom message api response
-
- eslint airbnb base
- jestjs - https://jestjs.io/
cp .env-sample .env
- via yarn or npm :
# install package
npm install or yarn install
# running app
npm run dev or yarn dev
# running unit tetsing
npm run test or yarn test
- via make :
# start aplication with docker
make docker-start
# stop docker container
make docker-stop
# remove docker container
make docker-down
#NODEJS
APP_PORT=8000
NODE_ENV=development
CLUSTER_MODE=off
JWT_SECRET_KEY=
#DB
DB_USERNAME=
DB_PASSWORD=
DB_PORT=
DB_DATABASE=
DB_DRIVER='postgres'
DB_HOST=
DB_NAME=
MONGO_URL=
docker-compose up --build
docker-compose up --build -d
# install package
docker-compose exec boillerplate-typescript npm install
# running unit testing
docker-compose exec boillerplate-typescript npm run test
.
├── .github/ * all workflows github actions
├── caprover/ * for deployment in caprover
├── coverage/ * all output coverage
├── build/ * all output build source code
├── docker/ * all dockerfile
├── src/ * all source code here
└── config/ * folder for configuration
| └── *.ts * all configuration like db, awes redis etc.
└── db/ * folder for database
| └── *.ts * all database files
└── interface/ * folder for interface
| └── *.ts * all interface files
└── lang/ * folder for language message
| └── *.ts * all language message files en, id etc.
└── middlewares/ * folder for middlewares
| └── *.ts * all middlewares files
└── repository/ * folder for repository / query logic
| └── *.ts * all utility files
└── transport/ * folder for transport / api, grpc or graphql
| └── *.ts * all transport files
└── usecase/ * folder for usecase / busines logic
| └── *.ts * all usecase files
└── utils/ * folder for utility
| └── *.ts * all utility files
- Guideline:
- Use camelCase for variable name, naming function
- Use UpperCase for Constant Variable
- Use PascalCase for class name, models, interface
- Use snake_case for file name
- Function name use Verb
- Variable name use Noun