How garc-ia/sandy-yasmin-agendamento-flow works
Project Type and Purpose
• This is a serverless full-stack web application: a React/TypeScript Single-Page Application (SPA) for salon appointment booking and administration, backed by Supabase (Postgres + Auth + Edge Functions).
• The README confirms use of Vite, React, TypeScript, shadcn-ui, Tailwind CSS, and Supabase.
High-Level Architectural Components
a. Client Browsers
• Public users: book appointments, view services.
• Authenticated clients: manage their profile & view appointment history.
• Admin users: dashboard for managing salons, services, appointments, clients, WhatsApp templates, etc.
b. Static Hosting / CDN
• Vite builds static assets (HTML, JS, CSS) deployed to a CDN (e.g., Vercel, Netlify) via Lovable.
c. React SPA
• src/pages & src/components: UI layers, routing via React Router or Vite’s file-based router.
• Global state & context: auth-context.tsx, theme-context.tsx, AppointmentDialogContext, etc.
• Custom hooks for business logic, data fetching, and mutation (src/hooks, src/components/appointment/context/hooks).
d. API & Data Layer
• Supabase client (src/integrations/supabase/client.ts) for Auth, Realtime, and Database (CRUD).
• Supabase Edge Functions (./supabase/functions) for server-side logic (auto-complete, reset appointments).
e. Database
• Supabase Postgres: tables for appointments, clients, professionals, services, reviews, WhatsApp templates, etc.
f. External Services
• WhatsApp integration via utility functions (src/lib/whatsappUtils.ts).
• Optional custom domains via Lovable.
Relationships and Data Flows
• Browser ↔ Static CDN: initial asset load (index.html, bundled JS/CSS).
• React SPA ↔ Supabase Auth API: sign-in, sign-up, session management.
• React SPA ↔ Supabase Postgres: queries (appointments, clients, services) and mutations through the JS client.
• React SPA ↔ Supabase Edge Functions: special RPC (auto-complete, reset) invoked over HTTP.
• Real-time subscriptions: React SPA listens to database changes (e.g., appointment status updates).
• Business logic encapsulated in custom hooks and context providers.
Architectural Patterns & Design Principles
• Component-based UI with a clear directory split: admin, appointment, auth, client-area, shared, ui primitives.
• Separation of concerns: UI components (src/components), pages (src/pages), business logic (src/hooks), data integrations (src/integrations), and utilities (src/lib, src/utils).
• Context providers for cross-cutting concerns (auth, theme, dialogs).
• Atomic/design system approach via shadcn-ui primitives in src/components/ui.
• Serverless functions for backend logic without managing servers.
Essential Details
• Supabase Auth and Database as separate services.
• Both static hosting and serverless function deployment.
• Real-time data path for live appointment updates.
• Atomic component system in the UI layer.