Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

A Microservice Template in NodeJS, TypeScript, and Express

License

vs4vijay/typescript-express-template

Repository files navigation

typescript-express-template

A Microservice Template in NodeJS, TypeScript, and Express

Express + Routing-Controllers + TypeScript + TypeORM + TypeDI


Installation

npm install
  • Create .env file from .env.example and populate environment variables

Running

# Build and Run
npm start
# Run on local machine with watcher
npm run start:dev

Features

  • TypeScript
  • Depedency Injection of Services, Repositories, Controllers
  • Modular App.ts
  • Properly structured codebase models, repositories, services, controllers, migrations etc.
  • ORM Migrations used for maintaining database schemas
  • Follows pure REST APIs
  • Input validations
  • Use of .env file
  • Git pre-commit hooks setup
  • Linting and Standard Formatting
  • Added system metadata like createdAt, updatedAt
  • Use of DTOs
  • Added audit log like createdBy, updatedBy
  • isActive
  • uuid as primary key
  • Soft Delete Options
  • Pagination
  • Structured Logging
  • Unit Testing
  • Authentication
  • Authorization
  • Error Handling and Generic Error Middleware
  • Search Framework
  • AbstractService or interface Service
  • Graceful Shutdown
  • Containerized with Docker

Libraries Used


Development

  • Create an entity: npm run typeorm -- entity:create -n User
  • Generate migration: npm run typeorm -- migration:generate -n CreateUser
  • Run the migrations: npm run typeorm -- migration:run

Notes:

  • Migration name pattern: AddTo
    • AddLastNameToUser
    • UpdateEmailToEmployee

Development Guidelines

  • Make use of index.ts in folder which has multiple files

Development Notes

AltStyle によって変換されたページ (->オリジナル) /