Skip to main content

Documentation Index

Fetch the complete documentation index at: https://mintlify.com/Nyverie/reservafacil/llms.txt

Use this file to discover all available pages before exploring further.

ReservaFácil uses PostgreSQL as its sole data store, accessed through Prisma ORM. The schema covers three core models — Usuario, Cancha, and Reserva — along with the enums that drive roles, court types, and booking states. This guide walks you through choosing and provisioning a database, pushing the schema, and optionally seeding local test data.

Supported Databases

ReservaFácil requires PostgreSQL 13 or later. The Prisma datasource is configured with provider = "postgresql" and reads the connection URL from the DATABASE_URL environment variable.

Neon.tech (Recommended)

Serverless PostgreSQL with a generous free tier, instant branching, and SSL enabled by default. No credit card required. Perfect for both development and production.

Any PostgreSQL 13+ Provider

Compatible with Supabase, Railway, Render, AWS RDS, Google Cloud SQL, or a self-hosted instance — as long as you can supply a valid connection string with SSL.

Setting Up Neon.tech

1

Create a Neon account

Go to neon.tech and sign up for free. You can authenticate with your GitHub, Google, or email account. No credit card is required for the free tier.
2

Create a new project

After signing in, click New Project. Give it a name (e.g. reservafacil), choose your preferred cloud region, and click Create Project. Neon provisions a PostgreSQL 16 database in seconds.
3

Copy the connection string

On the project dashboard, open the Connection Details panel and select the Prisma connection string format. It will look similar to:
postgresql://user:password@ep-xxx-yyy.us-east-2.aws.neon.tech/reservafacil?sslmode=require
Note the ?sslmode=require suffix — this is mandatory for Neon and is already included in the connection string it provides.
4

Add DATABASE_URL to your environment file

Create (or open) .env.local in the project root and set the variable:
# .env.local
DATABASE_URL="postgresql://user:password@ep-xxx-yyy.us-east-2.aws.neon.tech/reservafacil?sslmode=require"
.env.local is listed in .gitignore — never commit real credentials to version control.

Initializing the Database Schema

Once DATABASE_URL points to a live PostgreSQL instance, push the Prisma schema to create all tables and enums:
npx prisma db push
This command reads prisma/schema.prisma, compares it to the current database state, and applies the necessary DDL statements (CREATE TABLE, CREATE TYPE, etc.) to bring the two into sync. It is non-destructive on empty databases and ideal for first-time setup.
Environment variables loaded from .env.local
Prisma schema loaded from prisma/schema.prisma
Datasource "db": PostgreSQL database "reservafacil" at "ep-xxx-yyy.us-east-2.aws.neon.tech:5432"

🚀 Your database is now in sync with your Prisma schema.

✔ Generated Prisma Client (v6.19.3) to ./node_modules/@prisma/client in 312ms
After a successful push, your database will contain the following tables:
TableDescription
UsuarioPlatform users with roles: SUPERADMIN, ADMIN, USUARIO
CanchaSports courts with type, pricing, and capacity
ReservaBookings linking a user to a court with time slot and status
Prisma Client is regenerated automatically every time you run npm install, thanks to the postinstall script in package.json (prisma generate). You only need to run npx prisma db push manually when setting up a new database or after modifying schema.prisma.

The Seed Script

The seed script (prisma/seed.ts) populates your local development database with a minimal set of test users and courts so you can log in and explore all roles immediately after setup.

What the seed creates

Users (3)
RoleEmailPassword
SUPERADMINsuperadmin@reservafacil.comsuperadmin123
ADMINadmin@reservafacil.comadmin123
USUARIOusuario@reservafacil.comusuario123
Courts (3)
NameTypePrice per hourCapacity
Cancha Fútbol 1FUTBOLS/ 5010 players
Cancha Tenis ATENISS/ 304 players
Cancha BásquetBASQUETS/ 4010 players

Running the seed

Make sure your database schema is already pushed (see above), then run:
npm run seed
On success you will see:
Iniciando seed...
Seed completado!
Superadmin: superadmin@reservafacil.com / superadmin123
Admin: admin@reservafacil.com / admin123
Usuario: usuario@reservafacil.com / usuario123
The seed script calls prisma.reserva.deleteMany(), prisma.cancha.deleteMany(), and prisma.usuario.deleteMany() before inserting any data. Running it against a database that already contains real records will permanently delete all existing bookings, courts, and users. Only run npm run seed in a local development environment — never against your production database.

Inspecting the Database with Prisma Studio

Prisma Studio is a visual browser-based editor for your database. It is useful for verifying that the schema push applied correctly and for inspecting or manually editing records during development.
npx prisma studio
This opens a local web UI at http://localhost:5555 where you can browse every table, filter rows, and update fields without writing SQL.
Environment variables loaded from .env.local
Prisma Studio is up on http://localhost:5555

Build docs developers (and LLMs) love