How albatrossc/sppu-codes works
Project type and purpose
• This is a full-stack web application (“SPPU Codes”) built in Python (Flask or similar) and deployed on Vercel.
• Purpose: Serve SPPU lab assignments, code snippets, and exam PDF’s to students; allow code submission via a web form.
File structure
• app.py at root: the main HTTP server / Flask application.
• hosting/ folder: Python modules (downloads.py, minfy.py, version.py) defining route handlers or utility scripts.
• templates/: Jinja2 HTML templates for index, subject selector, viewer, submit, download, error, contact.
• static/: all front-end assets:
• css/ and js/ for styling and interactivity
• pdfjs/ and viewer.html for in-browser PDF rendering
• pyqs/ directory holding nested course-and-semester PDF files
• questions/: JSON files per subject, used by the backend to list available questions.
• answers/: source‐code files organized by subject folders (cgl, dsal, dsl, iotl, oop).
• requirements.txt: Python dependencies.
• vercel.json: deployment configuration for Vercel.
README for additional insights
• Confirms the site’s public URL, usage, and contribution flow (Submit Code page).
• Highlights that all data is served from code/JSON/PDF file system—no external database.
a. Main components
1. Client Browser (user’s Chrome/Firefox/mobile)
2. CDN / Static Asset Server (serving static/css, static/js, pdfjs assets, static/pyqs PDFs)
3. Web Server (app.py + hosting/*.py)
4. File Storage (answers/, questions/, static/pyqs/)
5. Deployment Platform (Vercel or any PaaS)
6. External Libraries (PDF.js, any Python libraries from requirements)
b. Relationships & interactions
• Browser → HTTP(S) request → Vercel edge → app.py
• app.py routes consult questions/*.json and answers/ directories, or write to answers/ on “submit”
• app.py renders Jinja2 templates + injects dynamic data
• Browser fetches CSS/JS/PDF assets directly from CDN/static server
• PDF.js in browser pulls PDF bytes from static/pyqs or answers (viewer route)
c. Architectural patterns & design principles
• MVC-style separation:
• Model = flat file storage (JSON, code files, PDFs)
• View = Jinja2 templates + static assets
• Controller = Flask route handlers in app.py/hosting
• Static + dynamic content separation: static assets served directly; dynamic pages rendered server-side.
• Stateless, serverless or micro-VM on Vercel: no in-app database, persistence via file system.
d. Key technologies
• Python (Flask or similar), Jinja2 templating
• JavaScript + jQuery (static/js/*.js) for client-side logic
• PDF.js for in-browser PDF rendering
• Vercel for deployment, vercel.json routing
• CSS modules for component styling