How himanchal-103/studyvault works
Project type and purpose
• StudyVault is a full-stack web application built with Django (MVT pattern) that provides both server-rendered pages (HTML templates + CSS/JS) and a REST API for dynamic features (base/api).
• Its primary goal is to allow users to create/join topic-centric discussion rooms, post messages, and share resources in real time or near real time.
Top-level architectural components
• Client tier: Web browser (desktop or mobile)
• Requests HTML pages or JSON via the REST API
• Renders HTML/CSS/JS from static assets
• Web-server tier: (e.g., Nginx or Apache in production)
• Serves static files (JS, CSS, images)
• Forwards dynamic requests to WSGI/ASGI application
• Application tier: Django project (“studyvault”)
• URL router (studyvault/urls.py + base/urls.py + base/api/urls.py)
• View layer:
– base/views.py for page endpoints
– base/api/views.py for JSON endpoints (DRF)
• Serializers: base/api/serializers.py
• Forms: base/forms.py
• Template layer: base/templates/... + project-level templates/
• Data tier: SQLite database (db.sqlite3) accessed via Django ORM (base/models.py)
• (Optional) External integrations: future real-time push via WebSockets or third-party auth/analytics services
Component interactions and data flows
a. Browser issues HTTP GET/POST to Web Server → Routed to Django URLconf
b. For page requests: Django view loads data via ORM → uses forms if needed → renders HTML via templates → returns HTML response
c. For API calls: REST API view uses serializers to validate/process input → ORM CRUD operations → returns JSON response
d. Static asset requests (CSS/JS/images) are served directly by the web server from the “static” directory
e. All data persistence and retrieval occur through Django’s ORM against SQLite
Architectural patterns & design principles
• Model-View-Template (MVT) separation
• RESTful API endpoints co-located in a subfolder (“base/api”)
• Template inheritance and componentization (e.g., activity_component.html, feed_component.html)
• Single project, single app approach with clear separation between “base” app logic and project configuration (studyvault)
• Migrations for schema evolution
Diagramming this specific project
• Client (Browser)
• Web Server (Nginx/Gunicorn or Apache/WSGI)
• Django Project (“studyvault” container)
– URL Router
– View Layer (separate Page Views vs. API Views)
– Templates & Static Assets
– Forms & Serializers
– Models & Migrations
• Database (SQLite)
• Browser → Web Server (HTTP) → Django URL Router
• Router → Page View → ORM → Database → View → Template → Browser
• Router → API View → Serializer → ORM → Database → Serializer → Browser
• Browser → requests for /static/js/, /static/styles/, /static/images → Web Server → Browser