How 150202-pratham/mongobuddy works
Project Type & Purpose
• Mongo Buddy is a full-stack, gamified learning platform for MongoDB (and/or Supabase).
• The frontend is a React SPA (Vite + Tailwind + React Context), deployed on Render.
• The “backend” is handled via Supabase (Auth + Postgres) and optionally a Node/Express layer (per README).
File Structure
• Top level: configuration files (vite.config.js, tailwind.config.js, postcss.config.js), package.json, public/ (static), src/ (React code).
• src/Components: UI modules (Auth, Index Page, Module lessons, Tasks, Debug panels, Bear mascots).
• src/config/supabase.js & src/services/supabaseProgressService.js: client-side access to Supabase.
• src/contexts/AuthContext.jsx: global auth state.
• No explicit “backend/” folder—data access is direct via supabase-js.
Extract Architectural Clues from the README
• Mentions Node.js/Express + MongoDB, but code uses Supabase. Treat Supabase (Auth + DB) as the primary API layer.
• Deployed on Render (URL given).
• Uses environment variables (VITE_SUPABASE_URL, VITE_SUPABASE_ANON_KEY).
• Gamified progression logic lives in React + Supabase stored procedures / SQL schema (supabase-schema.sql).
Main Components
a. Presentation Layer (Client Browser)
• React SPA (Vite-bundled, Tailwind-styled)
• UI components: AuthForm, QuizTasks, Module pages, Progress bar, Bear animations
b. API / BaaS Layer
• Supabase Auth (signup, login, JWT issuance)
• Supabase Database (Postgres tables for users, checkpoints, quizzes, tasks, progress)
• Optional Node/Express server (if actual REST endpoints wrap Supabase or MongoDB Atlas)
c. Data Layer
• Supabase-managed Postgres (or MongoDB Atlas if used)
• supabase-schema.sql defines tables & policies
d. Deployment & Hosting
• Render (serving static SPA)
• CI/CD (GitHub Actions or manual deploys)
e. External Services
• Firebase (if used for analytics or additional auth)
• Third-party libraries (Lottie for bear animations, supabase-js SDK, React Router)
Relationships & Data Flows
• Browser → Supabase Auth: login/signup requests → JWT
• Browser → Supabase DB: authenticated CRUD (progress, quiz answers)
• Browser → (Optional) Express API → MongoDB (if using separate backend)
• Supabase DB → triggers/policies → secure data access
• Git push → CI/CD → Render deploy → updated SPA
Architectural Patterns & Principles
• SPA with component-based UI (separation of concerns)
• BaaS pattern (delegating auth + data storage to Supabase)
• React Context for global state (AuthContext)
• Service layer (supabaseProgressService) abstracts data operations
• Environment-driven configuration (.env variables for endpoints/keys)