GithubHelp home page GithubHelp logo

dennbagas / nestjs-starter-project Goto Github PK

View Code? Open in Web Editor NEW
0.0 2.0 0.0 523 KB

Starter project with Typeorm and centralized environment configuration. It's also comes with Dockerfile and docker-compoe file. This features Typeorm auto migration

JavaScript 11.30% Dockerfile 6.15% TypeScript 79.76% Shell 2.80%

nestjs-starter-project's Introduction

Nest Logo

Description

Starter project with Typeorm and centralized environment configuration. It's also comes with Dockerfile and docker-compoe file. This features Typeorm auto migration at runtime in docker container before the nest js start. Forked from Nest framework TypeScript starter repository

Installation

$ npm install

Running the app

# development
$ npm run start

# watch mode
$ npm run start:dev

# production mode
$ npm run start:prod

Create migration file

Create ormconfig.json first in the root folder to set up your database. For reference read the ormconfig.json configuration.

$ npm run migration:generate "AddSomeTable"

This will create a migration file named {timestamp}-AddSomeTable.ts on /migration folder under the database module

Run migration on local machine

# this will run migration file
$ npm run db:migrate

# this will revert migration file
$ npm run db:revert

Docker build

# build docker images
$ docker build . -t nest-starter-project

# or run docker-compose
$ docker-compose up --build

Auto migration

Auto migration using typeorm migrationsRun at startup

Environment Configuration

Environment configuration done by loading all declared environtment in config module. If you want to add more configuration, add it to config.service.ts in config module

Interceptor

This starter project also comes with interceptor. These are:

  • Entity not found interceptor
    This interceptor will return 404 status code if the error type is EntityNotFoundError
  • Plain to class interceptor
    This interceptor will transform returned data match to the DTO, so we dont have to transform it manually
  • Response transform interceptor
    This interceptor will transform the response object so you can make a custom structur of the response object

Support

Nest is an MIT-licensed open source project. It can grow thanks to the sponsors and support by the amazing backers. If you'd like to join them, please read more here.

License

Nest is MIT licensed.

nestjs-starter-project's People

Contributors

dennbagas avatar dependabot[bot] avatar

Watchers

James Cloos avatar  avatar

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.