How xheikhtalha2004/vertex-labs works
Project Type and Purpose
• This is a full-stack, single-page web application built with Vite and React/TypeScript.
• Purpose: a marketing site with an AI-powered chat widget (Google Gemini API), a Supabase-backed contact form, and interactive 3D canvas animations.
• Deployed as a static build plus serverless API endpoints on Vercel.
File Structure
• Top-level “src” directory holds all client-side code:
• src/App.tsx + main.tsx + index.html: entrypoints
• src/components: subdivided into canvas (3D scenes), chat (AI UI), dom/Services/ContactForm, and a generic UI library
• src/lib: service wrappers (chatService.ts, formService.ts), Supabase client, utilities
• src/hooks: device/motion utilities
• src/shaders: WebGL GLSL materials
• “api” folder at root: two serverless functions:
• chat.ts – proxies chat requests to Google Gemini
• submit-form.ts – writes contact data into Supabase
• Config & deployment:
• .env.example + .env.local for API keys
• vite.config.ts, tailwind.config.js – build tools
• vercel.json – serverless routing
• setup-supabase.sql – table schema
Key README Insights
• Features: floating AI chatbot (Google Gemini), contact form saved to Supabase, WhatsApp handoff.
• Env vars for Google AI and Supabase.
• Deployment via Vercel CLI/GitHub with env var injection.
• Tested workflows: chat messages, form submissions, navigation.
a. Main Components
1) Client Browser (React SPA)
• UI: 3D Canvas (Three.js via React), Chat Widget, Contact Form, Site Navigation
• Service Clients: chatService (calls /api/chat), formService (/api/submit-form), direct Supabase client (optional)
2) Serverless API Layer (Vercel Functions)
• /api/chat → Google AI Studio API
• /api/submit-form → Supabase Insert
3) External Services
• Google AI Studio (Gemini API)
• Supabase (Postgres DB with contact_submissions table)
• WhatsApp (via chat widget handoff link)
4) Hosting/CI
• Vercel (serves static assets, runs serverless functions)
• GitHub (source repo, CI triggers)
b. Relationships and Data Flows
• User interacts with Chat Widget → React invokes chatService → POST /api/chat → serverless → Google AI → response → back to client UI.
• User submits Contact Form → React invokes formService → POST /api/submit-form → serverless → Supabase insert → success → client confirmation.
• Navigation, asset fetching and static content delivered from Vercel CDN.
• 3D Canvas shaders and assets loaded directly in the browser; no backend involvement.
c. Architectural Patterns & Principles
• Client-Server with thin serverless façade.
• Separation of concerns: UI components vs. service wrappers vs. API handlers.
• Modular React component hierarchy (canvas vs. chat vs. form vs. common UI).
• Environment-driven configuration for keys and endpoints.
• Scalability: serverless auto-scales with traffic.
d. Key Technologies
• Vite + React + TypeScript
• Three.js or react-three-fiber for 3D Canvas
• Tailwind CSS / PostCSS for styling
• Vercel Functions for serverless backend
• Google AI Studio (Gemini)
• Supabase (Postgres + Row-Level Security)
• GitHub + Vercel CI/CD