How milyonkifleyesus/wheels-and-code- works
Project type and purpose
• This is a full-stack, single-page web application for automotive sales and service.
• Frontend: React 18 + TypeScript + Tailwind CSS, built with Vite and hosted on Netlify.
• Backend: Supabase (PostgreSQL database, Auth, real-time subscriptions).
File structure
• Top level:
– Configuration files (.env.example, netlify.toml, tsconfig.json, vite.config.ts, etc.)
– supabase/ folder: SQL migration scripts and setup.sql for database schema and RLS policies.
– src/ folder:
• pages/ – route components (HomePage, InventoryPage, AdminPage, BookingPage, etc.)
• components/ – domain-specific UI:
· /admin (AdminDashboard, ContentManager, SEOManager, etc.)
· /booking (BookingManager)
· /home (HeroSection, ServicesPreview, etc.)
· /inventory (InventoryManager)
· /layout (Header, Footer)
· /ui (Modal, Toast, VehicleCard, Car3D, etc.)
• contexts/ – React Contexts wrapping Supabase clients and state (AuthContext, BookingContext, ContentContext, VehicleContext)
• lib/ and utils/ – Supabase client setup and shared helpers
• main.tsx & App.tsx – application entry point and root component
• Deployment scripts: package.json, Netlify configuration
README for additional insights
• Tech stack: React, TypeScript, Tailwind CSS, Vite; Supabase for backend; Netlify for hosting.
• Features: Vehicle inventory, booking, customer management, admin CMS, real-time updates.
• Deployment: Netlify build and environment variables, plus manual database migration steps.
Main components
a. Client Browser (User Interface)
– React SPA served from Netlify CDN
– Runs App.tsx, loads pages, components, contexts
b. Netlify (CI/CD & CDN)
– Hosts static bundle (dist/)
– Handles build (npm run build) and deploy
c. Supabase Backend
– Auth service (email/password, RLS policies)
– PostgreSQL database (schema defined by migration files)
– Real-time engine (for live updates on inventory, bookings, content)
d. External Services (if any)
– Third-party map or analytics services (optional / configurable in code)
Relationships and interactions
• Browser ↔ Netlify/CDN:
– Initial HTML/CSS/JS fetch (index.html, main.js, CSS)
• Browser ↔ Supabase:
– REST and WebSocket calls via @supabase/supabase-js client in lib/supabase.ts or utils/supabase.ts
– AuthContext wraps sign-in/out, token management
– Data fetch & subscriptions for pages (e.g., InventoryPage uses VehicleContext to list vehicles)
• Supabase Real-time → Browser:
– Subscriptions push updates to components (e.g., live inventory changes, booking confirmations)
Architectural patterns & design principles
• Component-based UI layering (pages → domain components → UI primitives)
• Context API for global state and dependency injection (Auth, Booking, Content, Vehicle)
• Infrastructure as code for database (SQL migrations under supabase/migrations)
• Static front-end hosting + serverless backend (BaaS model)