How kp-singh09/minor-project works
Project Type and Purpose
• Full-stack MERN (MongoDB, Express, React, Node.js) quiz-builder application
• Key features: dynamic form creation, interactive renderers, user authentication (Clerk), image hosting (ImageKit), analytics
File Structure
• Top-level:
– client/ → React + Vite frontend
– server/ → Express + Node.js backend
– package.json files, .gitignore, README.md
• client/src/ → UI components, pages, builder & renderer modules, layouts, themes, templates
• server/controllers, server/routes, server/models → MVC pattern
• External config: Clerk, ImageKit, .env files, tailwind.config.js, Vite & ESLint configs
README for Technical Stack & Data Flow
• Frontend stack: React, Tailwind, Framer Motion, Axios
• Backend stack: Express, Mongoose, MongoDB
• Auth: Clerk service
• Image uploads: ImageKit (via dedicated controller/routes)
• CORS between client (5173) and server (5000)
Main Components
a. Frontend (Browser):
– React App (App.jsx, main.jsx)
– Pages: Dashboard, FormCreator, FormRenderer, Results, Stats, Auth (SignIn, SignUp)
– Builder modules (components/builder/*) and Renderer modules (components/renderer/*)
– Axios HTTP client for API calls
b. Backend (Server):
– Express app (server/index.js)
– Routes layer (aiRoutes, formRoutes, responseRoutes, statsRoutes, imageKitRoutes)
– Controllers (aiController, formController, responseController, statsController, imageKitController)
– Models (Form, Question, Response) via Mongoose
c. Database:
– MongoDB Atlas (collections: forms, questions, responses, stats)
d. External Services:
– Clerk (authentication)
– ImageKit (image storage & CDN)
– (Possibly AI API behind aiController)
Relationships & Data Flow
• User → Browser → React UI
• UI → Axios → Express API (over HTTP, with CORS)
• Express Routes → Controllers → Mongoose Models → MongoDB
• Controllers → External services (Clerk for tokens, ImageKit for uploads, AI API for prompts)
• Server → returns JSON → UI updates state
Architectural Patterns & Design Principles
• MVC on the backend: separated models, controllers, and routes
• Component-based UI: builder vs. renderer modules
• API layer decoupling: client never talks directly to DB
• Single responsibility: each route & controller handles one concern
• Environmental configuration: .env in client & server for keys and URLs
1. Frontend (blue)
2. API Layer / Backend (green)
3. Database (orange)
4. External Services (purple)
b. Within each zone, list major subcomponents:
– Frontend: Pages, Builder Components, Renderer Components, Axios Client
– Backend: Express App, Routes, Controllers, Models
– Database: MongoDB Atlas
– External: Clerk, ImageKit, AI Service
– User interactions → Frontend
– Frontend → Backend (API calls)
– Backend → Database (reads/writes)
– Backend → External Services (auth, image, AI)