SOLID Singleton architecture with 3 layers / MCM / Monolitic
📦api-poc
┣ 📂src
┃ ┣ 📂middlewares
┃ ┃ ┣ 📜apikey.middleware.ts
┃ ┃ ┗ 📜authentication.middleware.ts
┃ ┣ 📂modules
┃ ┃ ┗ 📂v1
┃ ┃ ┃ ┣ 📂controllers
┃ ┃ ┃ ┃ ┗ 📜member.controller.ts
┃ ┃ ┃ ┣ 📂interfaces
┃ ┃ ┃ ┃ ┗ 📜request.interface.ts
┃ ┃ ┃ ┣ 📂middlewares
┃ ┃ ┃ ┃ ┗ 📜member.middleware.ts
┃ ┃ ┃ ┣ 📂models
┃ ┃ ┃ ┃ ┗ 📜member.model.ts
┃ ┃ ┃ ┣ 📂routes
┃ ┃ ┃ ┃ ┗ 📜member.route.ts
┃ ┃ ┃ ┣ 📂test
┃ ┃ ┃ ┃ ┣ member.spec.ts
┃ ┃ ┃ ┗ 📂schemas
┃ ┃ ┃ ┃ ┣ 📜login.schema.ts
┃ ┃ ┃ ┃ ┗ 📜member.schema.ts
┃ ┣ 📂services
┃ ┃ ┣ 📜jwt.service.ts
┃ ┃ ┣ 📜response-handler.service.ts
┃ ┃ ┣ 📜mongoose.service.ts
┃ ┃ ┣ 📜validator.service.ts
┃ ┃ ┗ 📜winston.service.ts
┃ ┣ 📂utils
┃ ┗ 📜app.ts
┣ 📜.env
┣ 📜.gitignore
┣ 📜README.md
┣ 📜index.ts
┣ 📜nodemon.json
┣ 📜package-lock.json
┣ 📜package.json
┗ 📜tsconfig.json
NodeJS Version: 14.17.3
NPM Version: 6.14.13
MongoDB Version: 5.0.6
- Install NodeJS and MongoDB Server
- Set enviroment variables configuration
./.env
- Install dependencies
npm install
- Run project
npm run dev(This command automatically CREATES the necessary COLLECTIONS into DATABASE) this mode is developer mode if you need to run in production mode please check section "Build and run in JavaScript"
email: root@admin.com
passw: admin123
- Transform TypeScript to JavaScript with:
npm run buildthis will create a folder./distwith project in JavaScript - Run project in JavaScript with
npm start
Run unit test:
- start test: npm run test
- generate coverage report: npm run test-report
You can find the coverage report at ./coverage once generated
- This is a base structure project and continue in development.
- This effort took about 22 Hours.
- Unit Tests are in progress but someones are ready!.