Several months ago, I posted API Project Template, Written in Typescript about boilerplate for building API project in Typescript.
Now, I made some changes especially in code style consistency, unit test coverage, swagger docs, and types.
What's new?
- Improve coverage unit test on repositories and services using Jest
- Refactor project structure as below
├── .husky/ # Pre-commit config for lint staged
├── docs/ # Swagger API docs
├── src/ # All application source
├──── @types/ # Type definition for modules
|
├──── api/
├────── controllers/ # Define all controllers
├────── middlewares/ # Define all middlewares
├────── models/ # Define all sequelize models
├────── repositories/ # Define all repositories
├────── routes/
├──────── v1/ # Define all v1 routes
├────── services/ # Define all services
├────── types/ # Define all input types
|
├──── config/
├────── appConfig.ts # Define app configuration
|
├──── constants/ # Define all constants
├──── database/ # Define database connection and sync tables
├──── utils/ # Define reusable libs
├──── server.ts # Create express config
├──── index.ts # ENTRYPOINT - Start server
|
└── ...
- Improve code style using class in repositories, services, and controllers
- Add express validator as middleware to validate API request
- and moreover...
See details of API Project Template v2.0.0 in this repo
Top comments (0)