How sebastienlaurentt/escape-game works
Main architectural layers/components
• Frontend (User Interface):
• Next.js “app” directory contains all page components arranged by user context: Public (in "(root)") versus authenticated sections (in "(auth)").
• Components are modularized into shared UI components (e.g., Header, Footer, ExperienceCard, BookingForm) and specialized components (account management, booking flows).
• Styling is handled via Tailwind CSS (see tailwind.config.ts & globals.css).
• Backend/API Layer:
• API routes are defined in “app/api” for authentication (using Kinde) and webhooks.
• This layer handles secure interactions (e.g., sign-in via kindeAuth) and processes events from external services (e.g., Stripe payments).
• Business Logic & Services:
• “lib” contains utility functions and service abstractions (like handling Prisma database interactions, Stripe, Supabase, and custom actions).
• The separation of logic into discrete files supports MVC-like separation within the Next.js framework.
• Data Persistence:
• Prisma is used to manage database schemas and migrations. The “prisma” folder houses all migration scripts along with the main Prisma schema.
• This layer represents the core of data storage (reservations, experiences, account data, etc.).
• External Integrations:
• Stripe integration for payments.
• Supabase for additional backend support (authentication or database operations).
• Kinde for sophisticated authentication.
• Email components for booking confirmation notifications.
Relationships and Data Flow
• The client (frontend pages and components) interacts with the backend by making API calls to the “app/api” endpoints.
• API routes process requests, utilize business logic (via functions in lib/), and interact with the database layer through Prisma.
• External services like Stripe and Supabase get invoked from these business logic modules, ensuring payments and user management work seamlessly.
• Static assets (CSS, images) in “public” support client-side rendering.
Architectural Patterns/Design Principles
• File-Based Routing in Next.js: The structure of the “app” folder shows clear segregation of routes and contexts (authenticated vs. public).
• Separation of Concerns: Note that API routes, business logic, and UI code are separated into distinct folder hierarchies.
• Database Abstraction via Prisma: The migrations and schema management highlight a clear DB abstraction that decouples business logic from direct DB calls.
• Client / Browser
• Next.js Pages (public: home, contact, FAQ, reservation, thank-you)
• Authenticated pages (account management & sub-pages: experiences, insights, opening, prices, reservations)
• Navigation (Header, MobileNav, BurgerMenu)
• API Endpoints
• /api/auth/[kindeAuth] for authentication
• /api/webhooks for external callbacks
• Business Logic / Services (lib)
• Prisma Integration (lib/prisma.ts)
• Payment Processing (lib/stripe.ts)
• External Data/Authentication (lib/supabase.ts)
• Utility functions (lib/utils.ts)
• Database
• Managed by Prisma (schema.prisma and migrations)
• External Services
• Stripe, Supabase, Kinde, Email Services (via components/emails)