Backend
* Python  3.12.10
* FastAPI 0.137.1 

Frontend
* Node  24.18.0
* React 19.2.7
* Next.js 16.2.10




# How to run it
===============

Usar `python run_dev.py` desde la raíz del repo. Basically, this script does the following: 

1. Base de datos (Docker)
    docker compose up -d db        # Levanta PostgreSQL 16 + PostGIS en localhost:5432 (user/pass/db = gotagig)

2. Backend (FastAPI)     
    python -m app.seed             # crea tablas + datos demo (músicos en VE/CL/IE)
    fastapi dev app/main.py        # http://localhost:8000 (docs interactivos en /docs)

3. Frontend (Next.js)
    npm run dev                    # http://localhost:3000




# Database
==========

Here's how the database is installed and accessed:

* The flow is: Docker container → SQLAlchemy engine (via DATABASE_URL) → GeoAlchemy2 Geography columns → raw PostGIS functions for geo queries.

* The DB isn't installed natively — it runs as a Docker container defined in docker-compose.yml:
    image: postgis/postgis:16-3.4   # Postgres 16 with PostGIS 3.4 preinstalled
    POSTGRES_USER: gotagig
    POSTGRES_PASSWORD: gotagig
    POSTGRES_DB: gotagig
    ports: "5432:5432"
    volumes: gotagig_pgdata         # persists data across container restarts

* By mounting a named volume (volumes: gotagig_pgdata)
    - docker compose down → container is destroyed, volume survives, your DB data is intact next time you up.
    - docker compose down -v → also deletes the volume, wiping all DB data (users, musicians, bookings you've created).


Here's the full picture of how the DB layer works:

* Engine & sessions - app/core/database.py

* Schema management - no Alembic. There are no migrations in the repo. Instead init_db() runs on app startup via the lifespan hook in main.py:
    Base.metadata.create_all(bind=engine) - creates any tables that don't exist yet, driven purely by the SQLAlchemy model definitions in app/models/
* Postgres itself - docker-compose.yml runs postgis/postgis:16-3.4 as the db service, credentials/DB name gotagig, matching .env.example's DATABASE_URL.

* Models (app/models/) - user.py, musician.py, booking.py. Geolocation uses a Geography(geometry_type="POINT", srid=4326) column (MusicianProfile.location), per the PostGIS convention in CLAUDE.md - queried with ST_DWithin/ST_Distance, not manual haversine.

* Geo conversions - app/services/geo.py bridges PostGIS Geography ↔ plain lat/lng for the API: point(lat, lng) builds a WKTElement for writes, coords(location) unpacks a Geography value back to (lat, lng) for responses (note the lon/lat vs lat/lng ordering gotcha it comments on).

* Seeding - app/seed.py exists for populating dev data.

# # Entoces, para el esquema de db señalado, tenemos que: 
    1. Install Docker + Docker Compose plugin
        sudo apt update
        sudo apt install -y docker.io docker-compose-plugin
        sudo systemctl enable --now docker
        systemctl status docker
        sudo usermod -aG docker $USER   # so you can run docker without sudo (re-login after)

    2. Start the DB container from the repo root (donde está docker-compose.yml): 
        docker compose up -d db

        Luego si queremos deterner o borrar el container: 
        docker compose stop       # Pausa temporal, planeás volver a levantarlo pronto. Después usás docker compose start (o up -d db) y sigue igual, mismo contenedor.
        docker compose down       # Desmontaje: Borra el contenedor (el volumen con los datos queda, salvo -v) — Se usa cuando vas a desinstalar la app del server, o querés forzar que se recree limpio el contenedor/red.
        docker compose down -v    # Además borra el volumen (se pierden los datos de la DB)
        En la práctica: stop para pausas cortas, down cuando es un "ya no más" o necesitás reconstruir desde cero
