How om-suman/cryptovote works
Project Type and Purpose
• CryptoVote is a monolithic, server-rendered full-stack web application built with Django (Python).
• Purpose: Provide secure online voting for institutions, with role-based access, real-time results, profile management, and an admin panel.
File Structure
• Top-Level:
• manage.py – Django management entry point
• cryptovote/ – Django project settings (asgi.py, wsgi.py, settings.py, urls.py)
• main/ – core “main” app (models, views, urls, admin, migrations, signals, tests)
• templates/ – HTML templates for Django’s server-rendered UI
• static/ & media/ – CSS and user upload storage
• db.sqlite3 – local relational database
• Patterns & Configuration:
• MTV pattern (Model-Template-View)
• Signals used for OTP/email (main/signals.py)
• URL routing in two layers: project-level and app-level
• Admin app for managing elections/users
• render.yml for deployment
README for Additional Insights
• Auth: Role-based login (voter vs. admin)
• OTP verification for signup/login
• Features: real-time result updates, profile pics, timezone customization
• Future: Blockchain integration, analytics export
Main Components
a. Client Layer
– Web Browser
– Static Assets (CSS under /static)
– Media Assets (profile pictures under /media)
b. Web/Application Layer
– Django Project (“cryptovote”): URL dispatcher, settings, WSGI/ASGI
– Django App (“main”): Views, Templates, Signals, Forms
c. Data Layer
– SQLite database (models.py in main/)
– File storage on local filesystem for media
d. External Services & Future Extensions
– Email/OTP provider (SMTP or external API)
– Potential Blockchain node/API for immutable vote logs
Relationships & Interactions
• Browser → Django URL Router → Views
• Views ↔ Models (read/write votes, users, elections)
• Views → Templates → Browser (HTML)
• Views → Signals → Email/OTP service
• Views → Media/Static file handlers
• Admin Panel → Models → Database
• Future: Views/API → Blockchain service
Architectural Patterns & Principles
• Django’s MTV pattern: separate concerns into models, templates, and views
• Layered architecture: presentation, application logic, persistence
• Use of signals to decouple OTP/email logic from core view code
• Role-based access control baked into Django auth
Technology Stack
• Python 3.8+, Django 3.2+
• SQLite (RDBMS)
• HTML/CSS, Django templating
• SMTP or external Email API for OTP
• Docker/Render (render.yml) or other PaaS for deployment
Essential Details to Capture
• URL routing split (project vs. app)
• Authentication & OTP flow
• Real-time result mechanism (could be simple polling vs. WebSocket via ASGI)
• File upload/download endpoints
• Admin management interfaces