Skip to main content

Documentation Index

Fetch the complete documentation index at: https://mintlify.com/Edfermachado/proyectoSistemas/llms.txt

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

This guide walks you through running UniEvents on your local machine from scratch. By the end you’ll have a fully seeded PostgreSQL database, all environment variables configured, and the development server running with five ready-to-use test accounts — one for each role in the system.
1

Clone the repo and install dependencies

Clone the repository and install all dependencies using pnpm. UniEvents uses pnpm as its package manager — make sure it is installed before proceeding.
git clone https://github.com/Edfermachado/proyectoSistemas.git
cd proyectoSistemas
pnpm install
This installs all runtime and dev dependencies declared in package.json, including Next.js 16, Drizzle ORM, Supabase JS, jose, sharp, and Zod.
2

Set up environment variables

Create a .env.local file in the project root. All variables below are read at runtime by the application — none have defaults that are safe for production.
cp .env.example .env.local   # if an example file exists, otherwise create it manually
# .env.local

# ─── Database ───────────────────────────────────────────────────────────────
# PostgreSQL connection string.
# Default targets the local Supabase Postgres instance on port 54322.
DATABASE_URI=postgresql://postgres:postgres@127.0.0.1:54322/postgres

# ─── Authentication ──────────────────────────────────────────────────────────
# Secret used to sign HS256 JWT session cookies via the `jose` library.
# Must be at least 32 characters long.
JWT_SECRET=uni-events-super-secret-key-32-chars!!

# ─── Supabase Storage ────────────────────────────────────────────────────────
# Your Supabase project URL (e.g. https://xxxx.supabase.co).
NEXT_PUBLIC_SUPABASE_URL=https://your-project.supabase.co

# Public anon key — safe to expose in browser bundles.
NEXT_PUBLIC_SUPABASE_ANON_KEY=your-anon-key

# Service role key — server-side only, never expose to the browser.
SUPABASE_SERVICE_ROLE_KEY=your-service-role-key

# ─── Runtime ─────────────────────────────────────────────────────────────────
NODE_ENV=development
The table below summarises every variable:
VariableRequiredDescription
DATABASE_URI✅ YesFull PostgreSQL connection string. Falls back to postgresql://postgres:postgres@127.0.0.1:54322/postgres in drizzle.config.ts only — always set explicitly.
JWT_SECRET✅ YesSigning key for session JWTs. Defaults to uni-events-super-secret-key-32-chars!! in src/lib/auth.tschange this in production.
NEXT_PUBLIC_SUPABASE_URL⚠️ OptionalSupabase project URL. If omitted, the Supabase client is not initialised and file uploads fall back to local storage.
NEXT_PUBLIC_SUPABASE_ANON_KEY⚠️ OptionalSupabase public anon key. Used as a fallback if SUPABASE_SERVICE_ROLE_KEY is not set.
SUPABASE_SERVICE_ROLE_KEY⚠️ OptionalSupabase service role key for privileged server-side uploads. Takes precedence over the anon key.
NODE_ENV✅ YesSet to development locally. In production the session cookie secure flag is automatically enabled.
The default JWT_SECRET value (uni-events-super-secret-key-32-chars!!) is public and must never be used in a production deployment. Generate a cryptographically random secret of at least 32 characters — for example:
openssl rand -base64 32
Supabase Storage is entirely optional for local development. When NEXT_PUBLIC_SUPABASE_URL or the key variables are missing, src/lib/supabase.ts exports null for the client and all upload functions gracefully return null, triggering the local filesystem fallback at /public/uploads. You can run the full application without a Supabase account.
3

Run Drizzle migrations

Apply the database schema to your PostgreSQL instance using Drizzle Kit. Choose the command that matches your workflow:
# Push the schema directly to the database (recommended for local dev — no migration files needed)
pnpm drizzle-kit push

# — OR — generate SQL migration files and then apply them
pnpm drizzle-kit generate
pnpm drizzle-kit migrate
Drizzle Kit reads the connection string from DATABASE_URI (via drizzle.config.ts) and creates all 10 tables: universities, categories, tenants, users, spaces, events, attendees, event_requests, system_settings, and scan_logs, along with all enum types and indexes.
drizzle-kit push is non-destructive on existing data but will apply schema changes immediately. Use drizzle-kit migrate in staging and production environments where you want a reviewable migration history.
4

Seed the database

Populate the database with demo universities, faculties, spaces, events, and test users by running the seed script:
pnpm seed
This executes src/db/seed.ts via tsx and creates the following data:Universities & Faculties
  • Universidad Central de Tecnología → Facultad de Ingeniería, Facultad de Ciencias de la Computación
  • Universidad Nacional de Artes → Facultad de Bellas Artes
Events — 8 sample events across all three faculties (free and paid)Test Accounts
RoleEmailPasswordDashboard
Super Adminadmin@gmail.comadmin/admin
Faculty Admin (Decano)decano@gmail.comdecano/faculty-admin
Event Managergestor@gmail.comgestor/faculty-admin
Access Controlportero@gmail.comportero123/faculty-admin
Regular Userestudiante@gmail.com123456/
The seed script also pre-registers the student user in two events (one free with confirmado status, one paid with pago_pendiente status) and prints the corresponding QR ticket tokens to the console so you can test the scanner immediately.
The seed script deletes all existing data before inserting fresh records (db.delete(...) is called for every table in order). Do not run pnpm seed against a database that contains data you want to keep.
5

Start the development server

Launch the Next.js development server:
pnpm dev
The application is now available at http://localhost:3000.
URLDescription
http://localhost:3000Public-facing app — browse universities and events
http://localhost:3000/adminSuper Admin dashboard
http://localhost:3000/faculty-adminFaculty Admin / Event Manager dashboard
http://localhost:3000/loginLogin page for all roles
Sign in with any of the seeded test accounts listed in Step 4 to explore the platform from each role’s perspective.

Build docs developers (and LLMs) love