nestjs-prisma-starter
Node.js Nest framework starter with Prisma
Configuration
- Create a
.env
file- Rename the .env.sample file to
.env
to fix it.
- Rename the .env.sample file to
- 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
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
- See app, app.module
- Exceptions Filter
- Logging Middleware
- Logger for Production
- JWT Authentication
- CRUD API Sample
- Unit Test
- E2E Test