miladr0 / express-typescript-mongodb

A boilerplate for creating production-ready API using Express, Typescript, MongoDB and Jest

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

🎫 A Class Base Routing Boilerplate for Node.js, Express.js, MongoDB with Typescript.

What is it?

Try to implement A Class Base Routing with clean structure and scalable boilerplate in Node.js,Express.js and Typescript.

Features


Getting Started

install dependencies

yarn

Without Docker

Note: It is assumed here that you have MongoDB running in the background.

set .env.development.local file with your credentials.(like DB URL)

Run the app

yarn dev

With Docker

Note: It is assumed here that you have installed Docker and running in the background.

yarn docker:db

set .env.development.local file with your credentials.(like DB URL)

Run the app

yarn dev


Route Documents

you can access swagger documentation at http://localhost:3000/api-docs




What is the Structure of template?

express-typescript-boilerplate
β”œβ”€ .github
β”‚  └─ workflows
β”‚     └─ tests.yml
β”œβ”€ README.md
β”œβ”€ ecosystem.config.js
β”œβ”€ jest.config.js
β”œβ”€ package.json
β”œβ”€ src
β”‚  β”œβ”€ __tests__
β”‚  β”‚  β”œβ”€ api
β”‚  β”‚  β”‚  └─ v1
β”‚  β”‚  β”‚     └─ auth
β”‚  β”‚  β”‚     └─ users
β”‚  β”œβ”€ api
β”‚  β”‚  └─ v1
β”‚  β”‚     β”œβ”€ auth
β”‚  β”‚     β”‚  β”œβ”€ auth.controller.ts
β”‚  β”‚     β”‚  └─ dtos
β”‚  β”‚     β”œβ”€ index.ts
β”‚  β”‚     └─ user
β”‚  β”‚        └─ user.controller.ts
β”‚  β”œβ”€ app.ts
β”‚  β”œβ”€ common
β”‚  β”‚  β”œβ”€ constants
β”‚  β”‚  β”‚  └─ index.ts
β”‚  β”‚  β”œβ”€ interfaces
β”‚  β”‚  β”‚  β”œβ”€ crud.interface.ts
β”‚  β”‚  β”‚  └─ timestamp.interface.ts
β”‚  β”‚  └─ types
β”‚  β”œβ”€ config
β”‚  β”‚  β”œβ”€ index.ts
β”‚  β”‚  └─ passport.ts
β”‚  β”œβ”€ exceptions
β”‚  β”‚  └─ HttpException.ts
β”‚  β”œβ”€ index.ts
β”‚  β”œβ”€ middlewares
β”‚  β”‚  β”œβ”€ auth.middleware.ts
β”‚  β”‚  β”œβ”€ handlingErrors.middleware.ts
β”‚  β”‚  └─ validation.middleware.ts
β”‚  β”œβ”€ models
β”‚  β”‚  β”œβ”€ tokens.model.ts
β”‚  β”‚  └─ users.model.ts
β”‚  β”œβ”€ services
β”‚  β”‚  └─ v1
β”‚  β”‚     β”œβ”€ auth.service.ts
β”‚  β”‚     β”œβ”€ index.ts
β”‚  β”‚     β”œβ”€ token.service.ts
β”‚  β”‚     └─ user.service.ts
β”‚  └─ utils
β”‚     └─ toJSON.plugin.ts
β”œβ”€ tsconfig.json

About

A boilerplate for creating production-ready API using Express, Typescript, MongoDB and Jest


Languages

Language:TypeScript 95.0%Language:JavaScript 4.1%Language:Dockerfile 1.0%