How mohdzaidnagori/meta-one works
Project type and purpose
• This is a full-stack web application built with Next.js (React framework) that embeds a WebGL Unity build, integrates real-time video calls via Agora, and uses Firebase for backend services (authentication, database, hosting).
• Key user flows include: user authentication/registration, browsing “spaces,” launching Unity experiences, and joining peer video calls.
File structure
• Top-level framework:
• pages/ → Next.js page-based routing (UI + API routes)
• component/ → shared React UI pieces (cards, navbar, loader, Unity integration, router guards)
• public/Build/ → exported Unity WebGL build (loader, .wasm, framework)
• assets/ → static data for UI
• firebase.js & .firebaserc → Firebase initialization & config
• component/redux/CounterSlice.js → Redux state management
• component/router/AuthContext & ProtectedRouter → client-side auth guard
• component/agora/VideoCall.tsx → Agora video call integration
README for additional insights
• Confirms Next.js architecture with API routes under pages/api.
• Standard dev commands (npm run dev) and Vercel deploy.
Main components
a. Frontend (Next.js React)
– pages/ UI entry points (index.js, login, spaces/unity.jsx)
– component/ reusable UI + routing + global state
– Redux store for shared client state
– AuthContext & ProtectedRouter for client-side route protection
– UnityLoader component embedding public/Build files into a <canvas>
– Agora VideoCall component for in-app video sessions
b. Backend/API (Next.js API routes)
– pages/api/hello.js (example)
– any future API routes (e.g., user/profile, space/data)
c. External Services
– Firebase Auth & Firestore (initialized in firebase.js)
– Firebase Hosting (firebase.json config)
– Agora Real-Time Communication service
d. Static Assets & Build
– public/Build (Unity WebGL loader & binaries)
– assets/data JSON or JS modules
– public/video & public/images for media
Relationships & interactions
• Browser ↔ Next.js Frontend (HTTP/HTTPS)
• Frontend → Firebase Auth (via firebase.js) for sign-in flows
• Frontend → Firestore for data reads/writes (spaces, user profiles)
• Frontend → Next.js API routes (serverless handlers) for custom logic
• Frontend → public/Build loader to fetch Unity engine files
• In-page Unity <canvas> ↔ React components (postMessage or UnityWebGL events)
• Frontend ↔ Agora SDK via WebRTC for peer video streams
Architectural patterns & design principles
• Component-based UI (React) with a clear pages/ vs. component/ separation
• API routes as serverless micro-endpoints (Next.js functions)
• Context + Redux for state and auth propagation
• Static build assets (Unity) served from CDN/hosting
• Service-oriented external integration (Firebase, Agora)
Elements the engineer must include
• Component blocks labeled: “Next.js Pages,” “React Components,” “Redux Store,” “AuthContext,” “Unity Loader,” “Agora VideoCall.”
• External blocks: “Firebase Auth,” “Firestore,” “Firebase Hosting,” “Agora RTC.”
• Static assets block: “Unity WebGL Build (.data, .wasm, .loader.js).”
• Browser → Next.js (page fetch)
• Next.js → Firebase (auth, data)
• React → Unity build (fetch engine files)
• React → Agora (initiate/join call)