mhrdini / nestjs

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Nest Logo

A progressive Node.js framework for building efficient and scalable server-side applications.

NPM Version Package License NPM Downloads CircleCI Coverage Discord Backers on Open Collective Sponsors on Open Collective Support us

Description

Nest framework TypeScript starter repository.

Installation

$ yarn install
$ npm i -g @nestjs/cli

Running the app

# development
$ yarn run start

# watch mode
$ yarn run start:dev

# production mode
$ yarn run start:prod

Test

# unit tests
$ yarn run test

# e2e tests
$ yarn run test:e2e

# test coverage
$ yarn run test:cov

Creating modules, controllers, and services/providers

# module
$ nest g module [resource-name]

# controller
$ nest g controller [resource-name]

# service
$ nest g service [resource-name]

# OR all at once
$ nest g resource [resource-name]

Set up Supabase and Prisma

  1. Create a Supabase account and a new project.
  2. Set up Prisma:
$ yarn add prisma -D
$ yarn dlx prisma init
  1. Initialise your .env and schema.prisma to contain the database and direct URL from Supabase by following the steps here.
  2. Model your data in the Prisma schema file, schema.prisma, following the steps here.
  3. Create your first migration using the following statement:
$ yarn dlx prisma migrate dev --name init
  • dev will ensure the migration history is saved in the prisma/migrations folder in the repo.
  1. When you make changes to your schema, you must generate the Prisma client before migrating:
$ yarn dlx prisma generate
$ yarn dlx prisma migrate dev --name [MIGRATION_NAME]
  1. Create the database resource:
$ nest g resource database

About


Languages

Language:TypeScript 96.0%Language:JavaScript 4.0%