Skip to content

๐Ÿ’Š Minimal Express RESTful API boilerplate with JWT auth and role based authorization using TypeScript, TypeORM and Docker with focus on best practices and painless developer experience.

License

Notifications You must be signed in to change notification settings

wemill/express-typescript-typeorm-boilerplate

ย 
ย 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 

Repository files navigation

Heisenberg

Express / TypeScript / TypeORM RESTful API boilerplate

Minimal boilerplate for building RESTful APIs with JWT authentication and role based authorization using Express, TypeScript, TypeORM & Docker with focus on best practices and painless developer experience.

Requirements

Running

Easily set up a local development environment with single command!

  • clone the repo
  • npm run docker:dev ๐Ÿš€

Visit localhost:4000 or if using Postman grab config.

What happened

Two docker containers are created:

  • one container instance with Postgres database seeded with ๐Ÿ’Š Breaking Bad characters in Users table. Postgres database default credentials are user=walter, password=white, that can be modified in .env file (not added to .gitignore for demo purposes).
  • and one Node (v14 Alpine) container instance with running boilerplate RESTful API service.

Features:

  • Express framework
  • TypeScript v4 codebase
  • TypeORM using Data Mapper pattern
  • Docker environment
    • Easily start local development using Docker Compose with single command npm run docker:dev
    • Connect to different staging or production environments npm run docker: [stage|prod]
    • Ready for microservices development and deployment.
      Once API changes are made, just build and push new docker image with your favourite CI/CD tool
      docker build -t <username>/api-boilerplate:latest .
      docker push <username>/api-boilerplate:latest
  • JWT authentication and role based authorization using custom middleware
  • Consistent HTTP responses and requests payloads with type definitions
  • Error handling middleware with consistent schema JSON response, that can be modified to suit your needs
  • Set local, stage or production environmental variables using dotenv with type definitions
  • Logging with morgan
  • Tests with Mocha and Chai
  • Linting with ESLint
  • Prettier code formatter
  • Git hooks with Husky and lint-staged
  • Automated npm & Docker dependency updates with Renovate (patch version only)
  • Commit messages must meet conventional commits format.
    After staging changes just run npm run commit and get instant feedback on your commit message formatting and be prompted for required fields by Commitizen

Other awesome boilerplates:

Each boilerplate comes with it's own flavor of libraries and setup, check out others:

About

๐Ÿ’Š Minimal Express RESTful API boilerplate with JWT auth and role based authorization using TypeScript, TypeORM and Docker with focus on best practices and painless developer experience.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • TypeScript 82.8%
  • Shell 14.2%
  • JavaScript 2.5%
  • Dockerfile 0.5%