/nestjs-prisma-starter

Node.js Nest framework starter with Prisma

Primary LanguageTypeScript

nestjs-prisma-starter

Node.js Nest framework starter with Prisma

Configuration

  1. Create a .env file
  2. Edit the schema.prisma file.

Installation

# 1. node_modules
npm ci
# 2-1. Generate schema from existing database
npx prisma introspect
# Convert snake_case to PascalCase, camelCase in the generated schema
npx prisma-schema-transformer ./prisma/schema.prisma
# 2-2. Write a model and generate it in the database
npx prisma migrate dev --preview-feature
# 3. Apply schema model to @prisma/client
npx prisma generate

Development

npm run start:dev

Run http://localhost:3000

Test

npm test # exclude e2e
npm run test:e2e

Production

# define NODE_ENV and PORT
npm run build
# NODE_ENV=production PORT=8000 node dist/app
node dist/app
# OR
npm start

Implements

Links