Welcome to "vitruve-tech-test", a wonderful "ONE-FRONT" full-stack webapp for Vitruve in Madrid! š šŖšø
This project uses Prisma as an ORM for database operations. Follow these steps to set up and use Prisma:
Navigate to the backend directory:
cd apps/backend
Ensure your prisma/schema.prisma
file contains the following:
generator client {
provider = "prisma-client-js"
}
datasource db {
provider = "postgresql"
url = env("DATABASE_URL")
}
model Athlete {
id String @id @default(uuid())
name String
age Int
team String
metrics PerformanceMetric[]
createdAt DateTime @default(now())
updatedAt DateTime @updatedAt
}
model PerformanceMetric {
id String @id @default(uuid())
athleteId String
athlete Athlete @relation(fields: [athleteId], references: [id])
metricType String
value Float
unit String
timestamp DateTime @default(now())
}
Set up your database connection by adding the DATABASE_URL
to your .env
file:
DATABASE_URL="postgresql://username:password@localhost:5432/your_database_name?schema=public"
Replace username
, password
, and your_database_name
with your actual database credentials.
Generate Prisma Client:
npx prisma generate
Run database migrations:
npx prisma migrate dev
To open Prisma Studio (a GUI for your database):
npx prisma studio
For more information on using Prisma, refer to the Prisma documentation.
Our backend is set up as part of an NX monorepo. Here are the key commands for backend development:
To start the backend in development mode:
npm run start:backend
To build the backend for production:
npm run build:backend
Run unit tests:
npm run test:backend
Run end-to-end tests:
npm run e2e:backend
To lint the backend code:
npm run lint:backend
We use Prisma for database management. Here are the key database-related commands:
npm run prisma:generate
npm run prisma:migrate
npm run prisma:studio
npm run prisma:seed
npm run db:setup
For more detailed information about the backend, please refer to the README in the apps/backend
directory.