Awesome Open Source
Awesome Open Source

NestJS

Description

Nest framework TypeScript starter repository.

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.

NestJS-Example

Dependencies

Installation

npm i

DB Settings

Create DB

sudo -i -u postgres

createdb nestjs_example_${env}

Create new migration

npm run db:migration:create -- ${migration_name}

Run migration

NODE_ENV=${env} npm run db:migration:run

| Note: you need to specify env only for development

Sync db schema

NODE_ENV=${env} npm run db:schema:sync

| Note: you need to specify env only for development

Running the app

development

npm run start:dev

beta

npm run build
npm run start:beta

prod

npm run build
npm run start:prod

Running the app with docker

docker network create nestjs_example_network

Update config.json:

  "DB_SETTINGS": {
    "host": "db", // service name from docker-compose.yml
    "port": 5432, // service port from docker-compose.yml
    ...
  },
  ...
  "REDIS_SETTINGS": {
    "host": "redis", // service name from docker-compose.yml
    "port": 6379, // service port from docker-compose.yml
    ...
  },

Build and run container

docker-compose -f docker-compose.yml up --build

After creating containers, create a database

docker-compose -f docker-compose.yml exec db sh

createdb nestjs_example_$ENV -U postgres

After create database, run db:schema:sync

docker-compose -f docker-compose.yml exec beta-web sh

npm run db:schema:sync

After restart the containers

docker-compose -f docker-compose.yml up

Get A Weekly Email With Trending Projects For These Topics
No Spam. Unsubscribe easily at any time.
typescript (11,188
graphql (1,058
redis (940
oauth2 (303
socket-io (145
nestjs (132
jwt-authentication (85
amqp (71
typeorm (61
dataloader (23