# Host App Implemented State ## What Exists - `ballbox` is the host app. - `/` stays as the marketing home. - `/admin` exists as the shared admin shell. - `/classes` exists as a separate public Ballbox surface. - `/classes-by-date` exists as a second public Ballbox surface for zone-first class discovery. - The public home navigation now surfaces `Reservas de cancha` and `Sign in` directly instead of exposing coach/admin labels in the marketing navbar, and both desktop/mobile nav links now expose explicit labels plus `aria-current` state for keyboard and screen-reader users. - `/classes/me` exists as a lightweight student follow-up view for submitted class requests. - Product-separated admin routes exist: - `/admin/tvs` - `/admin/payments` - `/admin/network` - `/admin/sports` - `/admin/players` ## Implemented Backend Foundation - Ballbox exposes admin/core APIs under `app/api`. - `/admin` can be protected with a simple shared-password session via `BALLBOX_ADMIN_PASSWORD`. - Payments integration endpoints exist as Ballbox-side host-app routes. - Ballbox owns native MercadoPago QR order creation at `/api/integrations/payments/orders` and native webhook intake at `/notification/mercadopago`. - Native payment persistence validates canonical `payment-vm_{vendingMachineId}-txn_{machineTxnId}` references before writing local approved sessions. - Ballbox exposes admin payments operations under `/api/admin/payments/*`. - Ballbox exposes shared network operations under `/api/network*`. - Route JSON/envelope helper boundaries now live in shared `lib/http/*-route-helpers.ts` modules (network, payments, players, sports) instead of route-local helper files under `app/api`. - TVs endpoints exist under `/api/tvs/*`. - Ballbox owns internal venues/screens/campaigns data and persists TVs in Ballbox Postgres; clubs are ATC-sourced and stored as `atcSportclubId` links only. - Seed/bootstrap fixtures for TVs live under `prisma/`, not runtime `lib/` modules. - Local development now also ships with a tracked Docker Postgres setup plus `.env.local` defaults, so Ballbox can run against `ballbox_local` without depending on the remote database. - Repo quality scripts exist for `lint`, `typecheck`, `test:contracts`, `test:e2e`, and `build`. - Playwright now runs with deterministic DB cleanup before and after the e2e suite for `PW E2E` fixtures. ## Surface Status - TVs runtime/admin live inside Ballbox. - TVs player delivery is a special-case host-app surface: `/player/[screenId]` is served from Ballbox but intentionally bypasses the Next client/React runtime in favor of plain HTML + JavaScript for constrained devices. - Payments remain external and are represented in Ballbox through integration routes. - Payments approved sessions now also have local admin CRUD/reconciliation inside Ballbox. - Network now has DB-backed admin CRUD for ATC-linked clubs, venues, and vending machines. - Current admin-only routes use simple shared access, not product-level RBAC. - Players surface now has a DB-backed read API for `Player` and `Membership`; admin CRUD is live and activity/participation models are still pending. - Sports now has DB-backed read/admin APIs for coaches, open matches, and classes; ATC/player flows are still pending. - Sports now also has a first student-facing `/classes` MVP over Ballbox-local offers/requests with resilient ATC public-read enrichment. - `/classes` now paints Ballbox-local offer data first and resolves ATC public-read context after load through cached host-app APIs, so ATC latency does not block first paint. - `/classes-by-date` now behaves as the public reservation entry point, asking for a zone first and then narrowing visible club availability from there. - `/clubs` now behaves as the club-only service home after authentication, presenting the club's operational modules as service cards before drilling into a specific service. - `/clubs/coaches` now behaves as a club operations surface with top-level `Calendar`, `Analytics`, `Sedes`, and `Profesores` sections: clubs can review the current week's coach availability/reservations, inspect professor/reservation money splits, manage venue quick settings, and work the coach roster from the same navbar. - Club workspace settings that edit existing venue/reservation data now auto-save in place, and clickable cards/links use explicit accent styling so they stand apart from read-only panels. - Public/auth/request/venue forms now expose stronger live-region semantics for submit/save feedback: `/coaches` auth errors announce through `role="alert"`, `/classes/[offerId]` request success/error copy is announced, and `/clubs/venues/[venueId]` autosave state is exposed as a live status instead of visual text only. - `/admin` overview now derives its cards from lightweight aggregate DB counts instead of hydrating full module datasets during SSR. - Browser e2e currently covers TVs offline runtime, active admin navigation, mobile smoke for `/admin/network` and `/admin/tvs`, network CRUD, payments CRUD/reconciliation smoke, players CRUD, and sports CRUD.