Web application for the digital ticketing platform. Customers browse events, reserve tickets, and view QR codes; organizers manage events, orders, and scan tickets at the gate.
Repository: github.com/HectorTorrez/ticket-frontend
| Area | Routes | Description |
|---|---|---|
| Public | /, /events, /events/:slugOrId |
Event catalog and detail with live inventory |
| Checkout | /events/:slugOrId/checkout |
Create order and mock payment |
| Auth | /login, /register |
JWT session stored in localStorage |
| Customer | /my-orders, /my-tickets |
Order history and ticket QR codes |
| Gate check | /check/:publicCode |
Public ticket lookup |
| Admin | /dashboard/* |
Events CRUD, orders, scanner, metrics |
- TanStack Start + Vite 8 — SSR app with file-based routing
- Nitro — Node server preset (
node-server) - TanStack Router + Query — routing and data fetching
- Tailwind CSS 4 + shadcn/ui — UI components
- Socket.IO client — live ticket inventory updates
- Zod — API response validation
- Biome — lint and format
User browser
│
▼
Nitro Node server (port 3000) — SSR + static assets
│
├── REST → ticket-api /api/v1/* (VITE_API_BASE_URL)
└── WS → ticket-api /inventory (JWT in auth handshake)
- HTTP:
src/lib/api/client.tswrapsfetchwith Bearer tokens, automatic refresh on 401, and Zod validation. All domain calls live insrc/lib/api/ticket-api.ts. - Auth: Session persisted under
ticket-platform-auth-v1inlocalStorage. Route guards insrc/lib/auth/guards.tsenforceADMINvsCUSTOMER. - Realtime:
use-inventory-socketconnects to the API Socket.IO namespace and refreshes availability whentickets:updatefires. - Data: TanStack Query caches API responses (30s stale time) in route loaders and mutations.
There is no dev proxy — the API must expose CORS for http://localhost:3000 (configured via CORS_ORIGINS on the API).
Copy .env.example to .env:
| Variable | Default | Purpose |
|---|---|---|
VITE_API_BASE_URL |
http://localhost:3001 |
API host (without /api/v1; added in code) |
VITE_SOCKET_PATH |
/socket.io |
Socket.IO path if non-default |
For production builds, set VITE_API_BASE_URL to your public API URL (e.g. https://api.example.com) before running pnpm build.
Prerequisites: Node 20+, pnpm, ticket-api running on port 3001.
pnpm install
cp .env.example .env
pnpm dev # http://localhost:3000pnpm build
node .output/server/index.mjsThe build output lives under .output/ (not dist/). Preview locally with pnpm preview.
| Command | Purpose |
|---|---|
pnpm dev |
Dev server on port 3000 |
pnpm build |
Production build (client + SSR + Nitro server) |
pnpm preview |
Preview production build |
pnpm test |
Vitest (passes when no test files exist) |
pnpm check |
Biome lint + format |
pnpm lint |
Biome lint only |
pnpm format |
Biome format |
src/
├── routes/ File-based pages (TanStack Router)
├── lib/
│ ├── api/ HTTP client, Zod schemas, typed API functions
│ ├── auth/ Session storage and route guards
│ └── websocket/ Inventory Socket.IO hook
├── components/ui/ shadcn components
└── integrations/ TanStack Query provider
| Document | Content |
|---|---|
| DEPLOYMENT.md | How to deploy the Nitro Node server or static hosting |
| IMPLEMENTATION.md | Full platform setup, AWS, and CI/CD (shared with API repo) |
Backend: ticket-api — see API.md for endpoints.
MIT — free to use, modify, and fork.