A TS express boilerplate using typedi and routing-controllers.
- Dotenv support
- Commonly used middlewares
- CORS
- DDos protection
- Gzip
- HTTP log
- Global error handler
- Attachment upload
git clone https://github.com/tanghongxin/express-ts-boilerplate.git
cd express-ts-boilerplate
pnpm i
pnpm dev
You are supposed to import database configuration and logic by yourself.
It's recommended to process DB Logic in Services instead of Controllers.
More use DTO to verify incoming data.
├── bundle ------------------- TS output dir
├── logs --------------------- log4js output dir
├── nodemon.json
├── package-lock.json
├── package.json
├── shell -------------------- Start script
├── src
│ ├── controllers ---------- MVC - Controllers
│ ├── dto ------------------ Data Transfer Object
│ ├── exceptions ----------- Custom exceptions
│ ├── index.ts ------------- Entry file
│ ├── middlewares ---------- Express middlewares
│ ├── services ------------- MVC - Services
│ ├── utils ---------------- TS functions
├── uploads ------------------ Attachment upload dir
├── tsconfig.json
└── types