How mmahmoud95/wild-oasis works
Main System Components
A. Client Layer
• Next.js Frontend (App Router)
• Authentication UI Components
• Reservation Management Components
• Cabin Browsing Components
B. Server Layer (Next.js API Routes)
• Authentication Handler
• Server Actions
• API Routes
C. External Services
• Supabase (Database & Authentication)
• Next Auth Integration
Component Organization
Structure the components as follows:
Frontend Components Layer
• Layout Components
• Header
• Navigation
• Footer
• SideNavigation
• Feature Components
• Cabin Management
• CabinList
• CabinCard
• Cabin Detail
• Reservation System
• ReservationForm
• ReservationList
• ReservationCard
• Auth Components
• SignInButton
• SignOutButton
• UpdateProfileForm
Data Flow Representation
• User authentication flow through NextAuth.js
• Reservation creation/management flow
• Cabin browsing and booking flow
• Data persistence flow to Supabase
Specific Implementation Details
a. App Router Structure
• Route hierarchy (/cabins, /account, /login)
• Dynamic routes ([cabinId])
• Server components vs client components
b. Authentication Flow
• NextAuth.js integration
• Supabase authentication
• Protected routes and middleware
c. Data Management
• Server actions for data mutations
• API routes for data fetching
• Supabase database interactions
Key Architectural Patterns
Emphasize:
• The App Router architecture of Next.js 13+
• Server Components usage
• Client-side interactivity boundaries
• Data fetching patterns
External Services Layer (Supabase)
→ Synchronous operations
⇢ Asynchronous operations
⇄ Two-way data flow
Remember to:
• Keep components grouped by feature
• Clear boundaries between client/server
• Protected vs public routes
• Loading and error states