How abidev2003/the-wild-oasis works
1. Overall shape
This is a single-page React application for hotel operations (“The Wild Oasis”), with the browser as the primary runtime and Supabase as the backend platform. The codebase is organized as a feature-driven front end rather than a traditional layered server/client split.
2. Top-level frontend architecture
src/main.jsx bootstraps the app, src/App.jsx wires the route tree, and src/ui/AppLayout.jsx provides the authenticated shell. The app uses route-level pages under src/pages for major screens such as Dashboard, Bookings, Cabins, Check-In, Restaurant, Settings, Account, Login, and password reset flows.
3. Feature modules as the main business boundary
Most business logic lives under src/features/*, with one folder per domain:
- authentication for login/signup/OAuth/password reset/user profile
- bookings for booking CRUD and booking detail views
- cabins for cabin CRUD and table operations
- check-in-out for arrival/departure processing
- dashboard for operational metrics and charts
- restaurant for orders tied to bookings
- invoice for invoice generation and email delivery
- settings for app/hotel configuration
Each feature bundles its UI components and custom hooks together, which keeps domain logic close to the screens that use it.
4. Data access layer
src/services/* is the boundary to Supabase and external integrations. Separate API modules exist for auth, bookings, cabins, restaurant, settings, and email. The feature hooks generally call these service modules rather than accessing Supabase directly, which keeps components mostly presentational.
5. Backend platform and persistence
Supabase is the external system of record for authentication, database tables, and likely storage. The supabase/migrations folder shows schema evolution and triggers, including employee table creation and cleanup-related triggers. This means the app depends on Supabase not just for CRUD, but also for server-side behavior enforced by database triggers.
6. Serverless/edge function boundary
There are Supabase Edge Functions under supabase/functions for auto-cancel, send-email, and send-invoice. These extend the backend beyond simple database access and are important architectural nodes:
- auto-cancel suggests scheduled/automated booking cancellation logic
- send-email handles outbound email delivery
- send-invoice likely generates or dispatches invoice-related messages
The invoice feature in src/features/invoice ties into these backend functions.
7. Authentication and route protection
Authentication is a first-class subsystem. The app includes login, signup, OAuth callback handling, forgot/reset password pages, user update forms, and logout. src/ui/ProtectedRoute.jsx indicates route gating for authenticated areas, while src/features/authentication/useUser.js and related hooks centralize session/user state.
8. Core operational workflows
The main hotel workflows are:
- Bookings: list, view, create, edit, delete
- Cabins: manage cabin inventory and properties
- Check-in/out: confirm arrivals, handle departures, view today’s activity
- Restaurant: create restaurant orders linked to bookings
- Dashboard: summarize recent bookings, stays, duration, and sales
These workflows are implemented as feature hooks plus tables/forms/modals in src/ui.
9. Shared UI and interaction primitives
src/ui contains the reusable design system and shell components: buttons, inputs, tables, modals, forms, filters, pagination, headers, sidebar, navigation, dark mode toggle, spinners, and confirmation dialogs. This is the main presentation layer used across all features.
10. State and cross-cutting concerns
Cross-cutting client state is handled with small utilities and context:
- src/context/DarkModeContext.jsx for theme mode
- src/hooks/useLocalStorageState.js for persisted client preferences
- src/hooks/useOutsideClick.js and useMoveBack.js for UI behavior
This suggests most domain state is server-backed, while local state is limited to UI preferences and interactions.
11. Media, uploads, and invoice output
src/data/Uploader.jsx and src/ui/FileInput.jsx indicate file upload support, probably tied to Supabase storage for cabin images or avatars. Invoice generation is split between a React invoice component (InvoicePDF.jsx) and email dispatch service/function, implying a workflow that produces a document and then sends it through backend email infrastructure.
12. Deployment and project tooling
The app is built with Vite and appears to be deployed on Netlify (netlify.toml). The repository also contains feature-plan docs and Supabase local metadata, which signals an actively evolving production app with database/schema managed alongside the frontend code.
13. What an architecture diagram should show
The central diagram should have:
- a browser-based React SPA
- a shared UI shell and feature modules
- a service layer bridging to Supabase
- Supabase Auth, Postgres, Storage, and Edge Functions as the backend boundary
- specialized flows for authentication, bookings/cabins, check-in/out, restaurant orders, dashboard analytics, and invoices/emails
The main architectural idea is that domain behavior lives in feature hooks/components, while persistence and automation live in Supabase.
Main entry points: pages Route pages · supabase Supabase · App.jsx App router · apiBookings.js Bookings API
Components 24
React SPA
Browser runtime, routing, shell, and shared UI
- main · Vite entry point that mounts the app
src/main.jsx - App router · Defines the route tree and top-level navigation
src/App.jsx - App shell · Authenticated application frame and chrome
src/ui/AppLayout.jsx - Protected route · Blocks unauthenticated access to private screens
src/ui/ProtectedRoute.jsx - Route pages · Page-level screens for dashboard, bookings, cabins, check-in, restaurant, settings, account, and auth flows
src/pages - Shared UI · Reusable inputs, tables, modals, navigation, and shell components
src/ui
Domain features
Feature-driven business modules and workflows
- Auth feature · Login, signup, OAuth, password reset, profile update, and session state
src/features/authentication - Bookings feature · Booking CRUD, detail views, and booking table operations
src/features/bookings - Cabins feature · Cabin inventory CRUD and table operations
src/features/cabins - Check-in flow · Arrival and departure processing plus today activity
src/features/check-in-out - Dashboard feature · Operational metrics, charts, and recent activity
src/features/dashboard - Restaurant feature · Orders tied to bookings and restaurant activity
src/features/restaurant - Invoice feature · Invoice generation and outbound email dispatch
src/features/invoice - Settings feature · Application and hotel settings management
src/features/settings
API services
Client-side integration layer for Supabase and external actions
- Auth API · Authentication/session calls to Supabase
src/services/apiAuth.js - Bookings API · Data access for bookings and stay records
src/services/apiBookings.js - Cabins API · Data access for cabin inventory and images
src/services/apiCabins.js - Restaurant API · Data access for restaurant bookings and orders
src/services/apiRestaurant.js - Settings API · Data access for app and hotel settings
src/services/apiSettings.js - Email service · Client-side helper for email/invoice delivery
src/services/emailService.js
Supabase backend
Auth, database, storage, migrations, and edge functions
- Supabase · External system of record for auth, data, storage, and edge functions
supabase - Migrations · Database schema evolution, triggers, and cleanup logic
supabase/migrations - Edge functions · Automated booking and email/invoice backend functions
supabase/functions - Storage · File storage for uploads and media assets
supabase
Connections 30
- main → App router: bootstraps · Entry point mounts the router tree
- App router → App shell: renders shell · Authenticated routes use the app layout
- App router → Protected route: guards routes · Private areas are wrapped by access control
- App router → Route pages: routes · Top-level page screens are attached to the router
- App shell → Shared UI: uses · Shell composes reusable UI primitives
- Route pages → Auth feature: uses · Auth-related screens delegate to the auth feature
- Route pages → Bookings feature: uses · Bookings pages are backed by booking workflows
- Route pages → Cabins feature: uses · Cabin screens rely on the cabins feature
- Route pages → Check-in flow: uses · Check-in pages use the arrival/departure flow
- Route pages → Dashboard feature: uses · Dashboard page aggregates metrics feature code
- Route pages → Restaurant feature: uses · Restaurant page uses booking-linked order workflows
- Route pages → Settings feature: uses · Settings page uses configuration feature code
- Bookings feature → Bookings API: calls · Booking hooks and actions go through the API layer
- Cabins feature → Cabins API: calls · Cabin CRUD is mediated by the cabins API
- Check-in flow → Bookings API: calls · Check-in and checkout rely on booking records
- Dashboard feature → Bookings API: reads · Analytics pulls booking and stay data
- Restaurant feature → Restaurant API: calls · Restaurant orders and booking lookups use the restaurant API
- Settings feature → Settings API: calls · Settings forms persist through the settings API
- Auth feature → Auth API: calls · Login, signup, session, and password flows use auth API
- Invoice feature → Email service: prepares · Invoice workflow prepares outbound email payloads
- Auth API → Supabase: auth · Authentication is backed by Supabase Auth
- Bookings API → Supabase: data · Booking data comes from Supabase
- Cabins API → Supabase: data · Cabin data and media metadata live in Supabase
- Restaurant API → Supabase: data · Restaurant data is stored in Supabase
- Settings API → Supabase: data · Settings are persisted in Supabase
- Email service → Edge functions: invokes · Email delivery is delegated to Supabase edge functions
- Invoice feature → Edge functions: invokes · Invoice generation ties into serverless invoice/email delivery
- Supabase → Migrations: contains · Schema and trigger changes are managed as migrations
- Supabase → Edge functions: hosts · Backend automation runs as edge functions
- Supabase → Storage: stores · Uploads and media assets are handled via storage