The main purpose is to define a complete Node.js+Typescript API template, in order to minimize the efforts in the early steps of a project. Also, make it as maintainable and robust as possible.
The whole app lives in the /src
folder, at this level you find:
- server.ts: which starts the server at a defined port.
- routes.ts: this is the main routes file.
/app
folder: under this folder where you'll find the app's controllers and routes./config
: config.ts loads and exports app's environmental variables. It also contains a white list array of trusted origins (part of CORS configuration). You should place there your trusted origins when in production./interfaces
folder: here you can place all your interfaces i.e: user./loaders
: now the startup process is divided into several files, they are here./middleware
folder: for the moment it contains the error handler middlewares. Here you can place your other middlewares./models
: planned to hold each Mongoose Schema used in the app./services
: a folder to hold the business logic./shared
folder: this is intended to hold all functions, constants, enums, etc. that are shared throughout the application. In the root of the project you'll find .env configuration file. This is where you should set apps: environment, salt rounds (for bcrypt algorithm), JWT secret, port and MongDB's path.
Add CORS middlewareAdd permission system- Add decorators
Add winston- Add SocketIO
- Add test cases
- Add support for MySQL
- Add GraphQL