How alan24rs/balet works
Project Type and Purpose
• Valet is a full-stack web application built with Next.js 15 (App Router) and React + TypeScript.
• It provides a public front end for drivers (map search, geolocation) and an admin panel for parking-lot owners, backed by Supabase (PostgreSQL + RLS + functions) and serverless API routes.
Top-Level Components
• Frontend Client (React/Next.js pages & components)
• Next.js Server (App Router handlers, API routes, middleware)
• Supabase Database (tables, views, RLS policies, triggers, stored functions)
• Business Logic Layer (src/services + RPC calls)
• External Services:
• Google Maps / Places API
• Resend Email API
• Deployment & CI/CD: Vercel + GitHub Actions (migrations in build)
Relationships and Data Flows
• Browser ←→ Next.js Client Components (React UI, Context Providers, Hooks)
• Client Components → Supabase Browser Client (direct queries + subscriptions for live data)
• Next.js API Routes & Server Components → Supabase Admin Client (secure server calls, migrations, Cron endpoints)
• Next.js Middleware → guards admin routes via Supabase Auth & Role checks
• Cron Routes (e.g., /api/cron/generar-boletas) scheduled via external scheduler trigger or manual call
• Notification Flow: services → Resend API for email invitations
• Geo Flow: client → Google Places API for autocomplete & map rendering
Architectural Patterns
• App Router + Server/Client Components separation
• Service Layer pattern (src/services/*) abstracting all DB and external-API calls
• Hook-based data fetching & mutations (src/hooks/queries, src/hooks/mutations)
• Context Providers for cross-cutting concerns (Theme, Query, Geolocation)
• Zod schemas (src/schemas) for validating inputs both client and server
• RLS + Stored Procedures in Supabase for data security and business rules