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.

This guide walks you from zero to a fully running ReservaFácil instance on your local machine. By the end you’ll have the development server running, the database schema applied, and three test accounts ready to log in with — one for each role.

Prerequisites

Before you begin, make sure you have the following available:
  • Node.js 18 or later — check with node -v
  • A PostgreSQL database — local install or a free hosted instance (see tip below)
  • Git — to clone the repository
Neon.tech offers a free-tier serverless PostgreSQL database that’s ready in under a minute — no local PostgreSQL installation needed. Create a project, copy the connection string from the dashboard, and use it as your DATABASE_URL. Neon also supports SSL by default, which matches the ?sslmode=require flag in .env.example.

Setup Steps

1

Clone the repository and install dependencies

Clone the ReservaFácil repository and install all Node.js dependencies. The postinstall script runs prisma generate automatically after install.
git clone https://github.com/Nyverie/reservafacil.git
cd reservafacil
npm install
2

Configure environment variables

Copy the example environment file to .env.local, which Next.js loads automatically during development.
cp .env.example .env.local
Open .env.local and fill in each variable:
# PostgreSQL connection string — replace with your actual credentials
DATABASE_URL="postgresql://user:password@host:5432/reservafacil?sslmode=require"

# Random secret used to sign JWT tokens — must be at least 32 characters
JWT_SECRET="tu_secreto_super_largo_aqui_minimo_32_caracteres"

# Full public URL of the app — only required in production
NEXTAUTH_URL="https://tu-proyecto.vercel.app"
  • DATABASE_URL — your PostgreSQL connection string. If you’re using Neon, paste the connection string from the Neon dashboard.
  • JWT_SECRET — any random string of at least 32 characters used to sign and verify JWT tokens. See the Environment Setup page for how to generate a secure value.
  • NEXTAUTH_URL — the canonical public URL of your deployment. Leave this as the placeholder for local development; it’s only required when deploying to production.
3

Push the database schema

Apply the Prisma schema to your database. This creates the Usuario, Cancha, and Reserva tables along with all enums and constraints — no migration files required during development.
npx prisma db push
You should see output confirming that the schema was applied. If you get a connection error, double-check your DATABASE_URL in .env.local.
4

Seed test data

Run the seed script to populate the database with three test user accounts and three sample courts across different sport types.
npm run seed
The script outputs the created accounts on success:
Iniciando seed...
Seed completado!
Superadmin: superadmin@reservafacil.com / superadmin123
Admin: admin@reservafacil.com / admin123
Usuario: usuario@reservafacil.com / usuario123
5

Start the development server

Launch the Next.js development server:
npm run dev
Open http://localhost:3000 in your browser. You should see the ReservaFácil landing page. Navigate to /login (or click the login link) to sign in with one of the test accounts below.

Test Accounts

The seed script creates one account for each role. Use these credentials to explore the platform:
RoleEmailPasswordDashboard redirect
SUPERADMINsuperadmin@reservafacil.comsuperadmin123/superadmin
ADMINadmin@reservafacil.comadmin123/admin
USUARIOusuario@reservafacil.comusuario123/dashboard

Role-Based Redirects After Login

After a successful login, the server reads the rol field from the JWT payload and redirects each user to their dedicated area:
  • USUARIO/dashboard — browse available courts, make and view personal reservations
  • ADMIN/admin — manage courts, confirm or cancel reservations across the platform
  • SUPERADMIN/superadmin — full system access including user management, role changes, and platform-wide reports
Attempting to access a dashboard you don’t have permission for (e.g. a USUARIO navigating to /admin) will result in a redirect back to your own dashboard. Route protection is enforced in Next.js middleware using the token HTTP-only cookie.

Build docs developers (and LLMs) love