How syedminamurrehman/epicdrive works
1. Top-level architecture
EpicDrive is a Next.js 16 App Router application written in TypeScript. The repo is split into route-driven UI under app/, reusable presentation components under components/, domain/data logic in services/, and Supabase/Postgres schema artifacts in supabase/. This is a server-rendered, route-centric architecture rather than a separate frontend/backend split.
2. Public customer-facing surface
The public site lives mainly in app/page.tsx, app/cars/page.tsx, and app/cars/[id]/page.tsx, with supporting legal pages for privacy and terms. The public experience includes a landing page, car catalog, individual vehicle detail pages, and a booking form. SEO is built into the routing layer via dynamic car pages, plus app/robots.txt and app/sitemap.ts.
3. Car discovery and booking flow
The main customer flow is: browse cars, filter/search, open a car detail page, then submit a booking request. UI pieces like SearchFilters, CarCard, CarGallery, and BookingForm support that flow. The booking form is the handoff point from UI to persistence: it collects customer and rental data and sends it into the service layer for database creation.
4. Admin portal
app/admin/ is a separate administrative area with its own layout and login page. It includes dashboards for analytics, bookings, customers, and fleet management, plus create/edit screens for fleet records. This is the operational boundary of the app: public users interact with listings and bookings, while staff manage inventory and booking status here.
5. Data access layer
services/carService.ts is the core business/data abstraction. It hides Supabase query details behind domain-oriented operations such as fetching cars, loading a car by ID, and creating bookings. The README indicates this layer also handles more complex filtering and joins, including post-query filtering for specialized fields like ADAS.
6. Database model
The Supabase/Postgres schema uses a polymorphic vehicle spec design. cars stores shared vehicle data, while specs_engine, specs_hybrid, and specs_electric store powertrain-specific fields. bookings tracks rental requests and their relationship to cars and customers. This split is the key persistence boundary and explains how one car type can map to different technical sub-records.
7. Supabase integration and environment boundary
lib/supabase.ts centralizes Supabase client setup, and the app relies on Supabase environment variables for URL and anon key. The README describes failover behavior when env vars are missing, which suggests the app is designed to keep building/running in degraded diagnostic mode rather than crashing immediately. That makes Supabase the primary external dependency for both data and auth.
8. Routing protection and request boundary
proxy.ts is the request interception layer for the app. In an architecture diagram, this is the place to show route-level protection around /admin, separating public traffic from staff-only traffic before pages are rendered.
9. Shared UI and brand system
Most of the visual experience is composed from reusable components in components/: navigation, hero sections, footer, FAQ, background effects, WhatsApp floating contact, and catalog/booking widgets. app/globals.css provides the global styling entry point for the Tailwind-based design system. This is a shared presentation layer used across both public and admin surfaces.
10. Types, constants, and domain consistency
types/index.ts and constants/index.ts provide the shared contract for vehicle categories, specs, and other app-wide domain values. These files reduce duplication between the public catalog, admin forms, and the service layer, keeping UI labels and database-shaped data aligned.
11. Static assets and car media
public/ contains optimized static assets, with per-car folders under public/cars/ for imagery and supporting media. These assets are consumed by the car gallery/detail views and are part of the product presentation layer, not the database.
12. Operational/diagnostic surfaces
The app/diagnostics route is a production-check endpoint for environment and database health. Together with SEO files and the Supabase-backed data layer, it shows the app has a production-ops mindset: observable, crawlable, and resilient enough for deployment on Vercel.
Main entry points: carService.ts Car service · layout.tsx Site shell · page.tsx Home page · schema.sql Schema
Components 19
App routes
Route-driven pages and layouts for public, admin, and operational surfaces.
- Site shell · Root layout and landing page for the public experience.
app/layout.tsx - Home page · Public landing page.
app/page.tsx - Car catalog · Browse and filter available vehicles.
app/cars/page.tsx - Car detail · Dynamic vehicle detail pages with booking entry point.
app/cars/[id]/page.tsx - Admin portal · Staff area layout and dashboard entry.
app/admin/layout.tsx - Admin login · Authentication entry for staff users.
app/admin/login/page.tsx - Admin ops · Analytics, bookings, customers, and fleet management screens.
app/admin/page.tsx - Booking form · Customer booking request handoff to persistence.
components/BookingForm.tsx - Legal pages · Privacy policy and terms pages.
app/privacy-policy/page.tsx - Ops pages · Diagnostics and crawlability endpoints.
app/diagnostics/page.tsx
Shared UI
Reusable presentation components used across the site.
- Catalog UI · Search, cards, and gallery used in the car discovery flow.
components/SearchFilters.tsx - Brand UI · Navigation, hero, footer, FAQ, and visual framing.
components/Navbar.tsx - Support UI · Booking and contact helpers such as WhatsApp floating action.
components/WhatsAppFloat.tsx
Data layer
Business logic, Supabase integration, and shared domain contracts.
- Car service · Supabase-backed car lookup, filtering, and booking creation.
services/carService.ts - Supabase client · Centralized Supabase client setup and environment boundary.
lib/supabase.ts - Domain types · Vehicle and booking shapes shared across UI and services.
types/index.ts - Constants · App-wide labels and vehicle category values.
constants/index.ts
Persistence
Supabase/Postgres schema artifacts.
- Schema · Cars, powertrain spec tables, bookings, and related persistence model.
supabase/schema.sql
Assets
Static media and public files consumed by the UI.
- Car media · Per-car imagery and supporting public media.
public/cars
Connections 20
- Site shell → Home page: renders · Root shell serves the landing page.
- Site shell → Brand UI: composes · Shared presentation components are used across the public site.
- Home page → Brand UI: uses · Home page is built from shared brand components.
- Home page → Support UI: uses · Home page includes support/contact affordances.
- Car catalog → Catalog UI: uses · Catalog route composes search, cards, and gallery UI.
- Car catalog → Car service: queries · Catalog route relies on car service for data and filtering.
- Car detail → Catalog UI: uses · Detail pages reuse gallery and card presentation.
- Car detail → Booking form: contains · Vehicle pages lead into booking submission.
- Booking form → Car service: submits · Booking form hands customer/rental data to service logic.
- Car service → Supabase client: uses · Service layer delegates database access to the Supabase client.
- Car service → Schema: maps to · Service operations correspond to cars, specs, and bookings tables.
- Car service → Domain types: types · Domain contracts keep service and UI data aligned.
- Car service → Constants: references · Filtering and labels use shared constants.
- Schema → Domain types: shapes · Database model informs shared application types.
- Admin portal → Admin login: gates · Admin area is separated by its login entry.
- Admin portal → Admin ops: contains · Admin portal groups operational screens.
- Admin ops → Car service: reads/writes · Fleet and booking management use the same service boundary.
- Ops pages → Supabase client: checks · Diagnostics validate environment and database connectivity.
- Ops pages → Schema: verifies · Operational checks depend on the persistence layer existing.
- Site shell → Car media: serves · Public media is consumed by the rendered site.