How minh01-hub/classforge works
Project type and purpose
• From the file tree and README we see:
• A Next.js “app” folder with multiple pages (allocate, analytics, students).
• A “backend” folder with Python modules (models.py, routes.py, database.py) and a runner (run.py).
• UI components (components/*.tsx) and shared utilities (lib).
• The README title (“ClassForge-AI-Powered-Customizable-Classroom-Allocation-System-for-Schools”) plus folder names indicate a full-stack web application that:
• Presents a React/Next.js-based front-end for administrators/teachers.
• Calls a Python backend API to store data, perform allocation computations (AI/ML), and serve analytics.
File structure
Top-level directories:
• app/ ← Next.js 13 “app router” pages + global CSS/layout
• backend/ ← Python service implementing REST endpoints, DB models, config
• components/ ← Reusable React UI components and sub-UI libs
• lib/ ← Shared TypeScript types and utilities
• public/ ← Static assets
Configuration files:
• next.config.ts, tsconfig.json, postcss.config.mjs, eslint.config.mjs → Next.js build & lint setup
• package.json, package-lock.json → Front-end deps
• requirements.txt → Python backend deps
README for additional insights
• It’s a standard Next.js project with a custom title.
a. Main components
1. Frontend (Next.js app folder)
• Pages: Allocate, Analytics, Students
• UI Components: dashboard-shell, network-visualization, classroom-allocation, allocation-parameters, etc.
2. Backend (Python service)
• API Routes (backend/app/routes.py)
• Models & business logic (backend/app/models.py)
• Database layer (backend/database.py + config)
3. Database
• Likely PostgreSQL or SQLite (configured in backend/config.py)
4. Optional External AI/ML Service
• Could be an internal module or external API called by backend for optimization
5. Public assets/CDN (public folder, static files)
6. Client browsers (Users: Admin/Teacher)
b. Relationships & interactions
• Browser → Next.js Frontend:
– Fetch SSR pages & static JS/CSS assets
– Calls client-side handlers (e.g., dropdowns, visualization)
• Frontend ↔ Backend API (HTTP/REST or GraphQL):
– Allocate classrooms: POST parameters → /api/allocate endpoint
– Fetch analytics: GET → /api/analytics
– CRUD Students: /api/students
• Backend → Database:
– CRUD via ORM models.py
• (Optional) Backend → AI/ML engine (internal library or external service) for optimization algorithm
• Next.js build tools, CI/CD (Vercel) handle deployment
c. Architectural patterns & design principles
• Separation of concerns: UI vs business logic vs data persistence
• Next.js App Router for routing + server-side rendering & static generation
• RESTful API design in Python backend
• Modular React component library for UI consistency
• Environment-based config (backend/config.py, .env integration)
• Possible MVC pattern in backend: models.py, routes.py, database.py
d. Key technologies/frameworks
• Frontend: Next.js 13 (app router), React, TypeScript, PostCSS
• UI library: in-house components (components/ui/*)
• Backend: Python (likely Flask or FastAPI), SQLAlchemy (models.py), uvicorn/gunicorn (run.py)
• Database: relational (Postgres/SQLite)
• Deployment: Vercel (frontend), any Python host (Heroku/AWS)