How pisamatech/pisamaapp works
Project Type and Purpose
• This is a single‐page application (SPA) built with React and Vite, acting as a full-stack frontend that communicates with a Supabase backend for authentication, data storage (reservations, billing, profiles), and real-time updates.
Main Architectural Components
a. Build & Dev Toolchain
• Vite: development server and build bundler (vite.config.js)
• ESLint/PostCSS/Tailwind: linting and styling configurations
b. Entry Point & App Shell
• src/main.jsx → renders <App /> into index.html
• src/App.jsx → top-level router + layout
c. UI Layer
• src/pages: page‐level views (Admin, CalendarDiario, Dashboard, etc.)
• src/components: reusable, atomic components (forms, dialogs, calendar widgets)
• src/components/ui: design system primitives (buttons, inputs, cards, etc.)
d. State Management
• src/stores: client‐side state (authStore, calendarStore, uiStore)
• React hooks (src/hooks) for encapsulating common logic (async handling, calendar state)
e. Service Layer
• src/services: business logic wrappers (adminService, billingService, reservationLogic, etc.)
• All services consume the Supabase client or fetch APIs
f. Data Layer / External Services
• src/supabase: Supabase client configuration + data access (profileService, reservationService)
• External: Supabase APIs (Auth, Postgres), email template (mail.html)
Component Relationships & Data Flow
• The browser loads Vite’s dev/build output (index.html + bundled JS).
• main.jsx initializes React root → App.jsx.
• App.jsx configures routes; user navigates to different pages under src/pages.
• Pages import UI components from src/components and UI primitives.
• UI events (e.g., “make reservation”) call handlers in src/hooks or directly invoke service layer (src/services).
• Services call Supabase client (src/supabase/index.js), which sends REST/Realtime requests to Supabase backend.
• Responses update local stores (Zustand-like or plain JS) in src/stores.
• Stores emit updates; React components re-render accordingly.
Architectural Patterns & Design Principles
• Separation of Concerns:
• UI vs. business logic vs. data access vs. state management
• Component Composition: small, reusable UI building blocks in src/components/ui
• Unidirectional Data Flow: actions → services → data layer → stores → UI
• Modular Folder Structure: grouping by “feature” (calendar, reservation, billing)
• Hooks for cross-cutting concerns (async, mobile detection, theme toggling)
Essential Elements to Capture
• Entry point and routing (Vite → main.jsx → App.jsx → <Routes>)
• UI component hierarchy (pages → components → ui primitives)
• State stores and how they’re updated
• Service layer as abstraction over Supabase client
• Supabase as the external data/auth backend
• Development/build support (ESLint, Tailwind, Vite)