How rajat1120/airbnb-clone works
Project type and purpose
• This is a full-stack web application: an Airbnb clone built with React on the frontend and Supabase on the backend.
• Purpose: let users search listings, authenticate (Google Sign-In), save favorites, book trips (payments via Stripe), and view data with infinite scroll and real-time sync.
File structure
• Top-level dirs:
• src: React entrypoint, components, hooks, Redux slices, API wrappers, styles.
• public & dist: static assets, HTML, manifest, robots.txt.
• supabase: edge functions (create-payment-intent), config.toml, seed.sql.
• config files: vite.config.js, tailwind.config.js, postcss.config.js, vercel.json.
• Patterns & layers:
• UI components (src/components) follow feature areas (Header, Footer, House-detail, Main, Modals).
• State management in src/redux (slices, store).
• Data fetching & caching via TanStack Query wrappers under src/api and src/payment.
• Supabase functions implement backend logic (payments).
• Deployment: Vite for build, Vercel for hosting, shell script for local run (run-react-app.sh).
README for additional insights
• Core features: authentication, search, infinite scroll listings, favorites, bookings.
• Tech stack reinforces layers: React Router, Redux Toolkit, React Query, Tailwind, Supabase (PostgreSQL + Auth), Stripe, Google OAuth, redux-state-sync for cross-tab sync.
a. Main components
• Client (Browser) – React SPA
• CDN/Static Host – serves index.html, JS/CSS bundles (Vercel or similar)
• API Layer – calls to Supabase client SDK + custom edge functions
• Authentication Service – Supabase Auth with Google OAuth
• Database – Supabase PostgreSQL
• Payment Processor – Stripe via Supabase edge function “create-payment-intent”
• State Management – Redux + redux-state-sync
• Data Fetching – TanStack Query
• External Services – Google OAuth, Stripe
b. Relationships & data flows
1. User → Browser UI → React Router → Component
2. UI dispatches Redux actions or triggers React Query hooks
3. React Query / Supabase client → Supabase Auth / REST endpoints → Database
4. Booking flow: UI → Supabase edge function (create-payment-intent) → Stripe → webhook → update DB
5. redux-state-sync synchronizes store across open tabs
c. Architectural patterns & design principles
• Separation of concerns: UI vs. state vs. data-fetching vs. backend logic
• Feature-based folder structure for components
• Centralized state (Redux) with slice per domain (App, Card, HouseDetail, mainForm)
• Serverless functions for secure operations (payments)
• CDN for static asset delivery, global performance
d. Key technologies & their roles
• React & React Router – SPA navigation & UI
• Redux Toolkit – global state & actions
• TanStack Query – caching & background refetch
• Supabase SDK – built-in auth & DB client
• Supabase Edge Functions – secure serverless endpoints
• Stripe – payment processing
• Tailwind – utility-first styling
• Vite – dev server & bundler
• Vercel – hosting & CDN