This guide walks you through cloning the repository, spinning up a PostgreSQL database, launching the Express API, seeding it with sample data, and connecting the React dashboard — giving you a fully functional local environment with 20 sample courts and 20 sample bookings ready to explore.Documentation Index
Fetch the complete documentation index at: https://mintlify.com/JuanSerna14/Final-lenguaje-Avanzado/llms.txt
Use this file to discover all available pages before exploring further.
Prerequisites before you begin:
- Node.js 18+ and npm (or yarn) installed on your machine.
- PostgreSQL available locally, or Docker (recommended) to run it in a container via the included
docker-compose.yml. - A terminal with basic Git access to clone the repository.
Clone and navigate
Clone the repository and familiarise yourself with its two top-level directories.The repo contains two independent projects:Each project has its own
package.json, dependencies, and .env file. Steps 2–4 configure the backend; step 5 configures the frontend.Start PostgreSQL
The backend ships with a The compose file creates a single A named volume (
docker-compose.yml that starts a PostgreSQL 16 container with the correct credentials pre-configured.postgres service with the following environment:pgdata) persists data across container restarts. The container includes a health check that polls pg_isready every 10 seconds.If you prefer to use a local PostgreSQL installation instead of Docker, make sure a database and user matching the values above exist, or adjust the
.env values in the next step accordingly.Set up the backend
Install dependencies, create the environment file, and start the development server.Create a Then start the server in watch mode:On first boot,
.env file in the arquimarket/ directory with the following variables:.env
initDatabase() is called automatically — it runs CREATE TABLE IF NOT EXISTS for canchas, reservas, and users. You should see:| URL | What you get |
|---|---|
http://localhost:8000/health | JSON health check: { "status": "OK", "timestamp": "2025-01-15T10:30:00.000Z" } |
http://localhost:8000/docs | Interactive Swagger UI for all endpoints |
Seed sample data
With the server running, open a new terminal tab and run the seed script to populate the database with sample courts and bookings:The seed script (
src/db/seed.ts) inserts:- 20 sample canchas — sport courts with realistic names, descriptions, and hourly prices.
- 20 sample reservas — bookings distributed across those courts with varied dates, time slots, and statuses (
pendiente,confirmada,cancelada).
GET http://localhost:8000/api/canchas (with a valid token) returns the full list.Set up the frontend
In a new terminal, navigate to the frontend directory, install its dependencies, and configure the API base URL.Create a The dashboard is now live at
.env file in the starter-vite-ts/ directory:.env
VITE_HOST_API is picked up by the Axios instance as the base URL for every API call. VITE_ASSETS_API can be left blank for local development.Start the Vite dev server:http://localhost:5173. Navigate to /auth/jwt/login to sign in (or register a new account at /auth/jwt/register). After a successful login, the access token is stored in sessionStorage under the key accessToken and injected automatically into every subsequent Axios request as Authorization: Bearer <token>.Backend Setup (detailed)
Full environment variable reference, database connection options, and production build instructions.
Frontend Setup (detailed)
Vite config, MUI theme customisation, and routing overview for the dashboard.
Authentication API
Register, login, token refresh, logout, and
/me endpoint reference with request/response examples.Docker Deployment
Containerise both services and run the full stack with a single
docker compose up.