How hectoray99/speeddigital works
1. This is a Vite + React + TypeScript single-page application. The entrypoint in src/main.tsx bootstraps App.tsx, and the UI is organized into route-driven screens rather than a server-rendered app.
2. The app is clearly multi-role and multi-tenant. There are three top-level experience areas: public-facing pages, tenant/admin pages, and super-admin pages. The presence of SuperAdminGuard, AuthGuard, SuperAdminLayout, and MainLayout shows that route access and shell chrome are separated from feature screens.
3. Public routes live under src/pages/public and cover landing, login, auth callback, a digital menu, and a public portal for students/gym attendance. These routes are likely accessible without the main admin shell and serve as the authentication and guest entry points.
4. The admin area under src/pages/admin is the core operational surface. It is subdivided by business domain: dashboard, clients, finance, kitchen, products, salon, services, settings, staff, and onboarding. This suggests one frontend supporting several vertical workflows within the same tenant.
5. A lot of the admin UX is modal-based. Components like CreateClientModal, CreateProductModal, CreateReceivableModal, RegisterPaymentModal, NewAppointmentModal, TablePOSModal, and EnrollModal indicate that many create/update flows happen in overlays rather than dedicated pages. That usually means the main pages are list/detail views with action-driven CRUD dialogs.
6. The services area is especially workflow-heavy. Files such as Agenda, MasterCalendar, DisciplineManager, Resources, CheckoutModal, and NewAppointmentModal point to scheduling, calendar coordination, appointment checkout, and resource management. This is the likely center of time-based operations and booking logic.
7. Finance is split into both a general finance page and a cash register page. Combined with receivables, debtor lists, payment registration, and the Supabase edge function named mp-checkout, the architecture includes payment orchestration and likely external payment-provider integration, not just local bookkeeping.
8. Backend state is centered on Supabase. src/lib/supabase.ts is the client entry point, supabase_schema_completo.sql defines the database schema, and supabase/functions contains serverless edge functions. This means authentication, persistence, and at least some business workflows are delegated to Supabase rather than a custom API server.
9. The two Supabase functions are important integration boundaries: send-receipt for outbound receipt/notification delivery and mp-checkout for checkout/payment creation. These are the main server-side business endpoints visible in the repo and likely connect the frontend to external services.
10. Client-side state is kept in a small set of stores: authStore and portalStore. That suggests global state is intentionally limited, with most domain state fetched on demand from Supabase and page-local UI state handled in components/modals.
11. bookingService.ts and cloudinary.ts are the notable non-Supabase service modules. Booking logic is separated from UI screens, and Cloudinary implies external media/file handling for uploads, assets, or user-generated content.
12. The super-admin area is a separate control plane for managing organizations, subscriptions, promotions, announcements, and the super-admin dashboard. This is a clear platform-operator boundary, distinct from day-to-day tenant administration.
13. The repository also includes onboarding flows for new tenants, including OnboardingWizard, GymOnboardingModal, and Onboarding.tsx. That indicates the app supports provisioning and initial setup of a new organization inside the same product.
14. From an architecture-diagram perspective, the main flow is: public entry/auth callback -> client-side auth state -> guarded admin or super-admin layouts -> domain pages/modals -> Supabase database/functions and external services like payment/receipt delivery and Cloudinary. The system is primarily a front-end SPA with Supabase-backed backend services and a role-based UI split.
Main entry points: MainLayout.tsx Main Layout · App.tsx App · supabase.ts Supabase · SuperAdminLayout.tsx Super Layout
Components 28
Client App
Vite + React SPA shell, routing, guards, and feature screens.
- Main · Bootstraps the React application.
src/main.tsx - App · Top-level route composition and app wiring.
src/App.tsx - Auth Guard · Protects tenant/admin routes.
src/components/AuthGuard.tsx - Super Guard · Protects super-admin routes.
src/components/SuperAdminGuard.tsx - Main Layout · Tenant/admin chrome and navigation.
src/components/layout/MainLayout.tsx - Super Layout · Super-admin chrome and navigation.
src/components/layout/SuperAdminLayout.tsx - Auth Store · Global auth/session state.
src/store/authStore.ts - Portal Store · Public portal/session state.
src/store/portalStore.ts
Public Experience
Unauthenticated entry points and public portal flows.
- Landing & Login · Landing page, login, staff login, and auth callback.
src/pages/public/landing/Landing.tsx - Public Portal · Student portal, attendance, and public router.
src/pages/public/portal/PublicRouter.tsx - Digital Menu · Guest-facing digital menu experience.
src/pages/public/menu/DigitalMenu.tsx
Tenant Admin
Role-scoped operational screens for tenant users.
- Dashboard · Tenant overview and operational home.
src/pages/admin/dashboard/Dashboard.tsx - Clients · Client management and detail views.
src/pages/admin/clients/Clients.tsx - Finance · Financial operations and cash register.
src/pages/admin/finance/Finance.tsx - Services · Scheduling, calendar, booking, and checkout workflows.
src/pages/admin/services/Agenda.tsx - Staff · Attendance, payroll, scheduling, and timeclock.
src/pages/admin/staff/Staff.tsx - Products · Product catalog and inventory-facing operations.
src/pages/admin/products/Products.tsx - Kitchen & Salon · Vertical-specific operational screens.
src/pages/admin/kitchen/Kitchen.tsx - Onboarding · Tenant setup and initial provisioning flow.
src/pages/admin/Onboarding.tsx
Super Admin
Platform operator control plane.
- Super Dashboard · Platform overview for operators.
src/pages/superadmin/SuperAdminDashboard.tsx - Organizations · Tenant and organization management.
src/pages/superadmin/SuperAdminOrganizations.tsx - Subscriptions · Subscription and platform billing controls.
src/pages/superadmin/SuperAdminSubscriptions.tsx
Backend Services
Supabase-backed persistence, edge functions, and external service integrations.
- Supabase · Frontend client for auth, data, and storage.
src/lib/supabase.ts - Schema · Canonical database schema definition.
supabase_schema_completo.sql - MP Checkout · Payment checkout creation and provider integration.
supabase/functions/mp-checkout/index.ts - Send Receipt · Receipt and notification delivery.
supabase/functions/send-receipt/index.ts - Booking Service · Shared booking and appointment logic.
src/services/bookingService.ts - Cloudinary · External media and upload handling.
src/services/cloudinary.ts
Connections 33
- Main → App: mounts · Application entry bootstraps the router shell.
- App → Auth Guard: protects · Tenant routes are wrapped by auth protection.
- App → Super Guard: protects · Super-admin routes are wrapped by role protection.
- Auth Guard → Main Layout: renders · Authenticated tenant users enter the main shell.
- Super Guard → Super Layout: renders · Authorized operators enter the super-admin shell.
- Main Layout → Dashboard: routes · Main shell hosts tenant screens.
- Main Layout → Clients: routes · Main shell hosts client management.
- Main Layout → Finance: routes · Main shell hosts finance screens.
- Main Layout → Services: routes · Main shell hosts booking and service workflows.
- Main Layout → Staff: routes · Main shell hosts staff operations.
- Main Layout → Products: routes · Main shell hosts product operations.
- Main Layout → Kitchen & Salon: routes · Main shell hosts vertical-specific workflows.
- Main Layout → Onboarding: routes · Main shell hosts tenant setup flow.
- Super Layout → Super Dashboard: routes · Super-admin shell hosts platform dashboards.
- Super Layout → Organizations: routes · Super-admin shell hosts organization management.
- Super Layout → Subscriptions: routes · Super-admin shell hosts subscription management.
- App → Landing & Login: exposes · Public routes provide entry and authentication.
- App → Public Portal: exposes · Public portal routes are reachable without the admin shell.
- App → Digital Menu: exposes · Guest menu route is public-facing.
- Landing & Login → Auth Store: updates · Login and callback flows populate auth state.
- Public Portal → Portal Store: updates · Portal flows keep public-session state.
- Auth Store → Supabase: auth/data · Auth state is sourced from Supabase.
- Portal Store → Supabase: data · Public portal reads/writes via Supabase.
- Dashboard → Supabase: reads · Tenant screens query backend data.
- Clients → Supabase: reads/writes · Client management persists through Supabase.
- Finance → MP Checkout: calls · Payment flows delegate checkout creation.
- Finance → Send Receipt: calls · Payment and receipt flows trigger notifications.
- Services → Booking Service: uses · Scheduling screens share booking logic.
- Services → Supabase: reads/writes · Service workflows persist operational data.
- Products → Cloudinary: uploads · Product/media workflows use Cloudinary.
- Supabase → Schema: persists to · Frontend client targets the Supabase schema.
- MP Checkout → Schema: writes · Checkout function records payment-related state.
- Send Receipt → Schema: reads · Receipt function reads transaction context.