Dyolink — Backend (NestJS)
Prerequisites
- Node.js 20+ and npm
- PostgreSQL reachable from your machine (local or remote)
First-time setup
-
Clone the monorepo and go to the backend app:
git clone <repository-url> dyolink cd dyolink/backend -
Install dependencies
npm install -
Environment
Copy
.env.exampleto.envand set at least:DATABASE_URL— PostgreSQL connection string for your dev databaseJWT_SECRET— strong secret for signing tokens
Do not commit.env.
-
Database URL for local dev
Point
DATABASE_URLat a database you created in Postgres (create an empty DB first if needed). -
Generate Prisma Client
npm run prisma:generate -
Apply migrations (creates/updates tables to match
prisma/schema.prisma)npm run prisma:migrateThis runs
prisma migrate dev. Use it during development when the schema changes. -
Seed (optional — sample data / bootstrap)
npm run prisma:seed
Run (development)
npm run start:dev
API listens on http://localhost:3000 by default (PORT in .env).
If the frontend runs on another origin (e.g. http://localhost:3001), set CORS_ORIGIN in .env to that URL.
After pulling latest main
git pull
npm install
npm run prisma:generate
npm run prisma:migrate
If teammates added migrations, step 4 applies them. Resolve migration conflicts locally before pushing.
Useful commands
| Command | Purpose |
|---|---|
npm run prisma:generate |
Regenerate client after schema.prisma changes |
npm run prisma:migrate |
Dev migrations (migrate dev) |
npm run prisma:deploy |
Production-style apply (migrate deploy) — e.g. CI/containers |
npm run build |
Compile Nest app |
npm run start:prod |
Run compiled app (node dist/main) |
Docker
Image build is defined in Dockerfile at this folder. For full-stack deployment and CI, see the repository root README.md.