How adilmunawar/aditrondev works
Project type and purpose
• From the README and file tree, this is a full‑stack, TypeScript‑based web chat application.
• The front end is a React + Vite SPA (pages, components, hooks, utils).
• The back end is “Backend‑as‑a‑Service” via Supabase: Auth, Postgres DB, Realtime subscriptions, plus Edge Functions for OTP login.
File structure
• Top‐level artifacts:
• index.html, vite.config.ts, tailwind.config.ts → static build & styling setup
• src/ → React application code (pages, components, ui library, hooks, integrations, utils)
• supabase/ → Supabase project config and serverless functions (send‑otp, verify‑otp)
• Patterns:
• Component hierarchy under src/components for UI (auth, chat, ui primitives)
• Integration folder (supabase client & types) abstracts BaaS interactions
• Utility modules for chat business logic
• Edge functions under supabase/functions act as custom “backend” endpoints
Key architecture insights from README
• No dedicated Node/Express server; uses Supabase as back end
• Standard install & build via npm/Yarn, deployed as static assets + Supabase functions
a. Main components
• Browser / React SPA
– UI Layer: pages + components (Splash, AuthForm, Chat UI, Profile, etc.)
– Domain Logic: custom hooks (useMobile, useToast), utils (chat helpers)
– Integration Layer: Supabase client (src/integrations/supabase/client.ts)
• Supabase Cloud
– Auth Service (phone login, 2FA)
– Database (Postgres; user, chat, message, OTP tables)
– Realtime Engine (WebSocket/pub‑sub on messages table)
– Edge Functions (send‑otp, verify‑otp)
• External SMS Provider (Twilio or similar) – invoked by Edge Functions
• Hosting/CDN – serves the static SPA assets
b. Relationships & interactions
1. Browser → Hosting/CDN: GET index.html & JS bundle
2. Browser → Supabase Auth: request session or JWT
3. Browser → Edge Function (send‑otp): POST phone → Function writes OTP to DB & calls SMS API
4. Browser → Edge Function (verify‑otp): POST code → Function validates & returns JWT
5. Browser → Supabase DB: authenticated REST/GraphQL calls to read/write chats, contacts, groups
6. Browser ↔ Supabase Realtime: WebSocket subscription to new messages/events
7. Edge Functions → External SMS Provider: send OTP SMS
c. Architectural patterns & design principles
• Layered separation: UI, business logic (hooks/utils), data/integration
• BaaS + Serverless (Edge functions) avoids traditional backend servers
• Event‑driven realtime updates (pub/sub on message table)
• Composition over inheritance in UI (atomic ui components)
d. Relevant technologies & frameworks
• React (TSX), Vite, Tailwind CSS for front end
• Supabase (Auth, Postgres, Realtime, Edge Functions)
• TypeScript throughout
• Utility libraries under src/lib and src/utils