Giter Site home page Giter Site logo

mkosir / typeorm-express-typescript Goto Github PK

View Code? Open in Web Editor NEW
406.0 9.0 132.0 1.23 MB

๐Ÿ’Š Minimal Express RESTful API boilerplate. Spin it up with single command. TypeScript, TypeORM, Postgres and Docker with focus on best practices and painless developer experience.

License: MIT License

JavaScript 2.59% Dockerfile 0.46% Shell 14.47% TypeScript 82.49%
express typescript nodejs boilerplate docker docker-compose postgres rest-api typeorm mocha

typeorm-express-typescript's Introduction

TypeORM / Express / TypeScript RESTful API boilerplate

CI TypeScript prettier Heisenberg

Boilerplate with focus on best practices and painless developer experience:

  • Minimal setup that can be extended ๐Ÿ”ง
  • Spin it up with single command ๐ŸŒ€
  • TypeScript first
  • RESTful APIs
  • JWT authentication with role based authorization

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 ๐Ÿ’ฅ

Containers created:

  • Postgres database container seeded with ๐Ÿ’Š Breaking Bad characters in Users table (default credentials user=walter, password=white in .env file)
  • Node (v16 Alpine) container with running boilerplate RESTful API service
  • and one Node container instance to run tests locally or in CI

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
    • Run unit, integration (or setup with your frontend E2E) tests as docker exec -ti be_boilerplate_test sh and npm run test
  • Contract first REST API design:
    • never break API again with HTTP responses and requests payloads using type definitions
    • Consistent schema error response. Your frontend will always know how to handle errors thrown in try...catch statements ๐Ÿ’ช
  • JWT authentication and role based authorization using custom middleware
  • Set local, stage or production environmental variables with type definitions
  • Logging with morgan
  • Unit and integration 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 (set to 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:

Contributing

All contributions are welcome!

typeorm-express-typescript's People

Contributors

dependabot[bot] avatar igortrinidad avatar mkosir avatar renovate-bot avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

typeorm-express-typescript's Issues

Postgres and migration script not able to run in windows 10

I have tried to run npm run docker:dev and the following error promted using powershell on Windows 10 HOME.

  • Postgress database system was interrupted;
    although its inturupted its showing running in docker
   database system is ready to accept connections
  be_boilerplate         | Server running on port 4000
  be_boilerplate         | Database connection success. Connection name: 'default' Database: 'boilerplate'

Here is docker log

image

  • migrate script is not working missing script: migration:generate
  • seed script is not working missing script: seed:run

image

Please give any solution for this.
Thanks

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.