How tajuddin232/votesecure works
This is an Express and MongoDB voting application. Users sign up or log in with a government ID and password, then use authenticated routes to manage their profile or cast one vote; admins manage candidates but cannot vote. Candidate vote totals are exposed in sorted order. The README also describes candidate listing, though no listing handler appears in the sampled route source. The graph distinguishes route responsibilities from the JWT and model layers; database persistence follows from the Mongoose connection and model operations.
Main entry points: candidate.js Candidate Routes · server.js Express Server · userRoutes.js Account Routes · db.js MongoDB Connection
Components 9
HTTP API
- Express Server
server.js
Identity and Access
- Account Routes
routes/userRoutes.js - JWT Authentication
jwt.js
Election Features
- Candidate Routes
routes/candidate.js
Persistence
- User Model
models/user.js - Candidate Model
models/candidate.js - MongoDB Connection
db/db.js
Other components
- Voter or Admin
- MongoDB
Connections 11
- Voter or Admin → Express Server: sends requests
README.md - Express Server → Account Routes: mounts routes
server.js - Express Server → Candidate Routes: mounts routes
server.js - Express Server → MongoDB Connection: loads connection
server.js - Account Routes → User Model: creates and queries
routes/userRoutes.js - Account Routes → JWT Authentication: issues and verifies tokens
routes/userRoutes.js - Candidate Routes → JWT Authentication: authenticates requests
routes/candidate.js - Candidate Routes → User Model: checks voter and admin
routes/candidate.js - Candidate Routes → Candidate Model: manages and counts votes
routes/candidate.js - MongoDB Connection → MongoDB: connects
db/db.js - Voter or Admin → Candidate Routes: requests candidate listing
README.md