REST API built with NestJS, Prisma v7, and MySQL.
- Node.js
- pnpm
- MySQL server running locally
pnpm installcp .env.example .envFill in .env with your values:
DATABASE_URL="mysql://usuario:contraseña@localhost:3306/nombre_db"
JWT_SECRET="cualquier_string_largo_y_random"
JWT_EXPIRES_IN="7d"
The database (
nombre_db) must exist in MySQL before running migrations:CREATE DATABASE nombre_db;
npx prisma generatenpx prisma migrate devpnpm run start:devThe API will be available at http://localhost:3000.
pnpm run start:devnpx prisma migrate dev --name describe-what-changed
migrate devrunsgenerateinternally. If you only change types without a migration, runnpx prisma generatemanually.
# Development
pnpm run start:dev # watch mode
pnpm run build # compile to dist/
pnpm run start:prod # run compiled output
# Testing
pnpm run test # unit tests
pnpm run test:watch # watch mode
pnpm run test:cov # coverage report
pnpm run test:e2e # e2e tests
# Code quality
pnpm run lint # eslint with auto-fix
pnpm run format # prettier
# Prisma
npx prisma migrate dev # create and apply migration
npx prisma generate # regenerate client after schema changes
npx prisma studio # visual DB browser