How abidev2003/the-wild-oasis-website works
Purpose and Runtime
This is a Next.js App Router application for discovering cabins and managing a guest booking lifecycle: authentication, reservations, checkout, reviews, wishlists, and trip itineraries. The primary UI entry is app/page.js; global composition is in app/layout.js. It runs as a Next.js server/client application, with deploy-oriented configuration in next.config.mjs and request interception in proxy.js.
Route and UI Composition
Route segments organize the product by domain:
• Cabin discovery and detail: app/cabins/page.js, app/cabins/[cabinId]/page.js
• Auth and recovery: app/login/page.js, app/signup/page.js, app/forgot-password/page.js
• Account area: app/account/layout.js, app/account/reservations/page.js, app/account/wishlist/page.js
• Booking payment: app/checkout/[bookingId]/page.js, app/cabins/thankyou/page.js
Reusable components under app/_components implement the shell, cabin catalogue, booking forms, account views, and interactive widgets. Header.js, Navigation.js, and SideNavigation.js define the shared navigation boundary.
Data Access and Domain Actions
Server-side data and mutations are centralized in:
• app/_lib/data-service.js
• app/_lib/actions.js
• app/_lib/booking-logic.js
Pages and forms should cross into these modules rather than directly coupling UI to persistence. Booking-specific rules are separated from general action orchestration, indicating a lifecycle where cabin selection and date input become a validated reservation, then transition into editing, checkout, or deletion flows.
Supabase Persistence and Authorization
Supabase is the primary backend for authentication and relational application data. Client/server access is separated by:
• app/_lib/supabase/client.js
• app/_lib/supabase/server.js
• app/_lib/supabase/middleware.js
The schema evolves through ordered migrations in supabase/migrations, including guest identity/RLS (0001_guests_auth_id.sql, 0002_rls_policies.sql), reviews and wishlists (0006_reviews.sql, 0007_wishlists.sql), payments, itineraries, conversations, search, and availability RPCs. This makes database authorization and RPC boundaries architecturally important, rather than merely UI-level access controls.
Identity and Protected Account Flow
Authentication behavior is encapsulated in app/_lib/auth.js and completed through app/auth/callback/route.js. Account pages are grouped beneath app/account, with a dedicated layout likely serving as the protected-area boundary. Authentication UI includes login, signup, password recovery, password update, and profile update components; account operations should rely on server-side auth/session context rather than browser-only state.
Reservations, Checkout, and Payment
The reservation flow spans cabin detail, booking UI, account management, and checkout:
• app/_components/ReservationForm.js
• app/account/reservations/edit/[bookingId]/page.js
• app/checkout/[bookingId]/page.js
app/_lib/razorpay.js identifies Razorpay as the payment integration, while supabase/migrations/0008_payment_fields.sql persists payment state. The booking identifier is the control-flow handoff between reservation creation/editing and checkout; the thank-you route is the post-payment destination.
AI, Search, and Stateful Client Features
Two server API boundaries expose automation features:
• app/api/chat/route.js
• app/api/recommend/route.js
These are backed by app/_lib/groq.js, with rate limiting in app/_lib/rate-limit.js; chat persistence is supported by supabase/migrations/0011_conversations.sql. Cabin search parsing and recommendation logic are separated in app/_lib/parse-search.js and app/_lib/suggestions.js, with database search support in 00012_search.sql. Client-wide state is limited to explicit contexts: app/_context/ReservationContext.js and app/_context/ThemeContext.js.
Main entry points: actions.js Domain actions · auth.js Session auth · server.js Supabase access · page.js Checkout
Components 22
Next.js UI
App Router pages, layouts, and shared client features.
- App shell
app/layout.js - Discovery home
app/page.js - Cabin catalogue · Cabin listing and detail routes.
app/cabins/page.js - Reservation form · Captures dates and cabin reservation intent.
app/_components/ReservationForm.js - Protected account · Reservations and wishlist area.
app/account/layout.js - Reservation editing
app/account/reservations/edit/[bookingId]/page.js - Checkout · Uses booking ID as the payment handoff.
app/checkout/[bookingId]/page.js - Payment confirmation
app/cabins/thankyou/page.js - Authentication UI · Login, signup, and recovery routes.
app/login/page.js - Shared navigation
app/_components/Header.js - Client contexts · Reservation and theme state.
app/_context/ReservationContext.js
Server Domain
Centralized server-side data, actions, and booking rules.
- Data service · UI persistence boundary.
app/_lib/data-service.js - Domain actions · Orchestrates mutations and lifecycle transitions.
app/_lib/actions.js - Booking rules · Validates and manages reservation lifecycle rules.
app/_lib/booking-logic.js - Session auth
app/_lib/auth.js
Supabase & Integrations
Identity, relational data, authorization, payments, and AI services.
- Supabase access · Separate browser and server database clients.
app/_lib/supabase/server.js - Supabase database · Bookings, guests, reviews, wishlists, payments, and conversations.
supabase/migrations - Auth callback
app/auth/callback/route.js - Razorpay
app/_lib/razorpay.js - AI APIs · Chat and recommendation endpoints.
app/api/chat/route.js - AI search services · Groq-backed chat/recommendations with parsing, suggestions, and rate limits.
app/_lib/groq.js - Request proxy · Applies request-time session handling.
proxy.js
Connections 22
- App shell → Shared navigation: renders
- Discovery home → Cabin catalogue: discovery flow
- Cabin catalogue → Reservation form: selects cabin
- Reservation form → Domain actions: creates reservation
- Client contexts → Reservation form: reservation state
- Protected account → Reservation editing: manages bookings
- Reservation editing → Domain actions: updates reservation
- Domain actions → Booking rules: applies rules
- Domain actions → Data service: persists changes
- Data service → Supabase access: queries and RPCs
- Supabase access → Supabase database: data and RLS
- Authentication UI → Auth callback: completes sign-in
- Auth callback → Session auth: establishes session
- Protected account → Session auth: requires session
- Session auth → Supabase access: uses server session
- Request proxy → Session auth: request session
- Checkout → Domain actions: loads booking
- Checkout → Razorpay: initiates payment
- Razorpay → Supabase database: payment state
- Checkout → Payment confirmation: payment complete
- AI APIs → AI search services: automation requests
- AI search services → Supabase access: search and conversations