How chirag2483/sparkathon_loners works
Project Type & Purpose
• Meesho-verse AI is a full-stack Meta-Commerce platform delivering an immersive 3D shopping experience in a browser.
• It consists of a rich frontend (Three.js, WebRTC, Socket.IO, computer vision) and a Node.js/Express.js backend handling static assets, REST endpoints, and real-time events.
File-Structure Analysis
• Top-level “client/” folder: HTML pages, CSS, JS libs (Three.js, loaders), assets (models, textures), and a “src/” subfolder organized by feature (character, env, shop, tryon, video).
• “server/” folder: Node.js server.js (Express + Socket.IO + CORS), room-server.js (WebRTC/Socket signaling), plus install scripts and package.json.
• No standalone database folder—room state appears in-memory or ephemeral; AI calls originate from the client via ai-config.
Key Components
a. Frontend (Client)
• Static Web Server (serves HTML/CSS/JS)
• Three.js Renderer & 3D Scene Graph
• Virtual Try-On Module (WebRTC camera + face-tracking + computer vision)
• UI Components (character selector, shop interface)
• Real-time Collaboration Module (Socket.IO client + WebRTC media streams)
• AI Assistant Client (fetches from external AI APIs)
b. Backend (Server)
• Express.js HTTP API (serves static content, REST endpoints: /api/rooms, /api/rooms/:code, etc.)
• Socket.IO Server (events: join-room, share-product, chat-message, etc.)
• room-server.js (WebRTC signaling for lobby/room RTC)
• Configurable CORS layer
c. External Services
• AI Service Providers (OpenRouter, OpenAI, Claude, Cohere, Hugging Face)
• (Optional) Reverse Proxy / Load Balancer (Nginx)
• (Optional) Process Manager (PM2)
Component Interactions & Data Flows
• Browser requests static assets via HTTP GET → Express.js
• User actions (join room, share product, chat) emit Socket.IO messages to Socket.IO Server
• Socket.IO Server relays real-time events to other clients in the same room
• WebRTC negotiation & media streams use room-server.js as a signaling intermediary
• Virtual Try-On module captures camera feed → local processing → overlays 3D garments
• AI Assistant UI sends REST/Fetch to external AI APIs (through client-side ai-config.js)
• Checkout/Order operations occur via REST endpoints (if extended to a database)
Architectural Patterns & Principles
• Modular Frontend by feature (character, env, shop, tryon, video)
• Separation of Concerns: Static content vs. real-time events vs. AI calls
• Event-Driven Communication (Socket.IO) for low-latency collaboration
• Externalized AI logic—keeping API keys/config in ai-config.js and environment variables
• Progressive Enhancement—fallbacks for camera/microphone permissions