How pratham0809/hack-this-fall works
Project type and purpose
• This is a full-stack, monolithic web application (“KnowledgeKnights”) providing educational games and quizzes.
• Frontend: EJS-templated HTML, SCSS/CSS, Tailwind, static game UIs (Dino, Space, Coin Scraper), TensorFlow.js model for sketch recognition.
• Backend: Node.js + Express.js, MVC pattern (routes → controllers → models), Twilio OTP integration, MongoDB for persistence.
• Use cases: user signup/login with OTP, play games (score persisted), quiz platform, leaderboards, teacher dashboard.
File structure
• Top-level
• README.md, .gitignore
• Server/ – contains entire application
• Server/
• index.js – Express entry point, middleware setup, route mounting
• /routes – Express routers per feature (user-routes.js, games.js, twilio-sms.js, dashboard.js)
• /controller – business logic (user_controller.js, games.js, dashboard.js, twilio-sms.js)
• /models – Mongoose schemas: User, Quiz, Leaderboard
• /database/connection.js – MongoDB connection
• /public – static assets: CSS/JS, images, TensorFlow.js model files, sketch.js
• /views – EJS templates organized by feature (login, games, dashboard, etc.)
• package.json / .env.example – dependencies and environment settings
Key insights from the README
• System architecture follows MVC pattern
• Twilio OTP for authentication
• Frontend prototype -> EJS + SCSS + Tailwind
• External ML model loaded client-side (model.json + .bin)
• Client Browser – loads EJS views & static assets; runs game logic (sketch.js, TensorFlow.js)
• Web Server (Express) –
– Router Layer (/routes)
– Controller Layer (/controller)
– Model Layer (/models) – Mongoose schemas
– Static Asset Server (/public)
• MongoDB – stores Users, Quizzes, Leaderboards
• External Service – Twilio OTP API
• (Optionally) Client-side ML Inference – TensorFlow.js model files (served by /public)
1. Browser → HTTP Request → Express routers
2. Routers → Controller logic → Model operations → MongoDB
3. Controller → Twilio API calls (HTTP) → Twilio OTP → Controller → Browser
4. Browser loads static JS (sketch.js) & TensorFlow model from /public → ML inference locally
5. Game UI sends score submission → Express → MongoDB → Leaderboard updates
6. Teacher dashboard UI Fetches aggregated data → Express → MongoDB → EJS view render
c. Architectural patterns & design principles
• MVC separation: clear Router / Controller / Model layers
• REST-style endpoints for user, game, dashboard, Twilio
• Static asset delivery for client-side ML + game code
• Single process, monolithic deployment
d. Key technologies & libraries (annotate near components):
• Node.js, Express.js
• MongoDB, Mongoose
• EJS templating, SCSS/Tailwind CSS, p5.js or custom sketch.js
• Twilio OTP service (twilio-sms.js)
• TensorFlow.js for drawing recognition