# modulus19/digital-voting-system-voxa- architecture

> Architecture diagram of the GitHub repository modulus19/digital-voting-system-voxa-, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-10-04). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/modulus19/digital-voting-system-voxa-
- Repository: https://github.com/modulus19/digital-voting-system-voxa-

## Overview

VOXA is a poll-and-voting application: users register and verify email, browse or create polls, cast votes, and review results; administrators manage polls and users. The frontend routes those experiences and calls the Express API, whose controllers delegate to domain services and MongoDB models. The README confirms a MongoDB-backed frontend/backend application, but does not detail capabilities; route and component coverage therefore follows the source index. Several domain pages and services are unsampled, so their internal links are omitted rather than inferred.

Main entry points: [`Backend/src/app.ts`](https://github.com/modulus19/digital-voting-system-voxa-/blob/master/Backend/src/app.ts) (Express application), [`Frontend/src/routes/AppRoutes.jsx`](https://github.com/modulus19/digital-voting-system-voxa-/blob/master/Frontend/src/routes/AppRoutes.jsx) (Page routing), [`Backend/src/Services/otpService.ts`](https://github.com/modulus19/digital-voting-system-voxa-/blob/master/Backend/src/Services/otpService.ts) (OTP service), [`Backend/src/Routes/pollRoutes.ts`](https://github.com/modulus19/digital-voting-system-voxa-/blob/master/Backend/src/Routes/pollRoutes.ts) (Poll routes)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_frontend["Web application"]
  node_routes["Page routing<br/>[AppRoutes.jsx]"]
  node_authpages["Account pages"]
  node_authcontext["Auth context<br/>[AuthContext.jsx]"]
  node_pollpages["Poll pages"]
  node_adminpages["Admin pages"]
  node_authapi["Auth API client<br/>[authApi.js]"]
  node_apiclient["API client<br/>[api.js]"]
end

subgraph group_api["API and access"]
  node_app["Express application<br/>[app.ts]"]
  node_authroutes["Auth routes<br/>[authRoutes.ts]"]
  node_pollroutes["Poll routes<br/>[pollRoutes.ts]"]
  node_voteroutes["Vote routes<br/>[voteRoutes.ts]"]
  node_resultroutes["Result routes<br/>[resultRoutes.ts]"]
  node_authmw["JWT authentication<br/>[auth.ts]"]
end

subgraph group_identity["Identity"]
  node_authcontroller["Auth controller<br/>[authController.ts]"]
  node_authservice["Account service<br/>[authService.ts]"]
  node_otpservice["OTP service<br/>[otpService.ts]"]
  node_email["Email delivery<br/>[emailService.ts]"]
  node_users[("User records<br/>[user.model.ts]")]
  node_otps[("OTP records<br/>[OTP.ts]")]
end

subgraph group_polls["Poll lifecycle"]
  node_pollcontroller["Poll controller<br/>[pollController.ts]"]
  node_pollservice["Poll service<br/>[pollService.ts]"]
  node_pollmodel[("Poll records<br/>[poll.model.ts]")]
end

subgraph group_participation["Voting and results"]
  node_votecontroller["Vote controller<br/>[voteController.ts]"]
  node_voteservice["Vote service<br/>[voteService.ts]"]
  node_resultcontroller["Result controller"]
  node_resultservice["Result service<br/>[resultService.ts]"]
end

node_user(("User"))
node_admin(("Administrator"))

node_user -.->|"uses"| node_routes
node_admin -.->|"uses"| node_routes
node_routes -->|"routes to"| node_authpages
node_routes -->|"routes to"| node_pollpages
node_routes -->|"routes to"| node_adminpages
node_authpages -.->|"calls"| node_authapi
node_authcontext -->|"calls"| node_authapi
node_authapi -->|"uses"| node_apiclient
node_apiclient -.->|"HTTP requests"| node_app
node_app -->|"mounts"| node_authroutes
node_app -->|"mounts"| node_pollroutes
node_app -->|"mounts"| node_voteroutes
node_app -->|"mounts"| node_resultroutes
node_authroutes -->|"dispatches"| node_authcontroller
node_pollroutes -->|"authenticates"| node_authmw
node_pollroutes -->|"dispatches"| node_pollcontroller
node_voteroutes -.->|"authenticates"| node_authmw
node_resultroutes -->|"authenticates"| node_authmw
node_authcontroller -->|"calls"| node_authservice
node_authcontroller -->|"calls"| node_otpservice
node_authservice -->|"reads and writes"| node_users
node_authservice -->|"requests verification"| node_otpservice
node_otpservice -->|"reads and writes"| node_otps
node_otpservice -->|"reads and updates"| node_users
node_otpservice -->|"sends codes"| node_email
node_pollcontroller -->|"calls"| node_pollservice
node_pollservice -->|"reads and writes"| node_pollmodel
node_votecontroller -->|"calls"| node_voteservice
node_resultcontroller -->|"calls"| node_resultservice

click node_routes "https://github.com/modulus19/digital-voting-system-voxa-/blob/master/Frontend/src/routes/AppRoutes.jsx"
click node_authpages "https://github.com/modulus19/digital-voting-system-voxa-/tree/master/Frontend/src/pages/auth"
click node_authcontext "https://github.com/modulus19/digital-voting-system-voxa-/blob/master/Frontend/src/context/AuthContext.jsx"
click node_pollpages "https://github.com/modulus19/digital-voting-system-voxa-/tree/master/Frontend/src/pages/user"
click node_adminpages "https://github.com/modulus19/digital-voting-system-voxa-/tree/master/Frontend/src/pages/admin"
click node_authapi "https://github.com/modulus19/digital-voting-system-voxa-/blob/master/Frontend/src/services/authApi.js"
click node_apiclient "https://github.com/modulus19/digital-voting-system-voxa-/blob/master/Frontend/src/services/api.js"
click node_app "https://github.com/modulus19/digital-voting-system-voxa-/blob/master/Backend/src/app.ts"
click node_authroutes "https://github.com/modulus19/digital-voting-system-voxa-/blob/master/Backend/src/Routes/authRoutes.ts"
click node_pollroutes "https://github.com/modulus19/digital-voting-system-voxa-/blob/master/Backend/src/Routes/pollRoutes.ts"
click node_voteroutes "https://github.com/modulus19/digital-voting-system-voxa-/blob/master/Backend/src/Routes/voteRoutes.ts"
click node_resultroutes "https://github.com/modulus19/digital-voting-system-voxa-/blob/master/Backend/src/Routes/resultRoutes.ts"
click node_authmw "https://github.com/modulus19/digital-voting-system-voxa-/blob/master/Backend/src/Middleware/auth.ts"
click node_authcontroller "https://github.com/modulus19/digital-voting-system-voxa-/blob/master/Backend/src/Controllers/authController.ts"
click node_authservice "https://github.com/modulus19/digital-voting-system-voxa-/blob/master/Backend/src/Services/authService.ts"
click node_otpservice "https://github.com/modulus19/digital-voting-system-voxa-/blob/master/Backend/src/Services/otpService.ts"
click node_email "https://github.com/modulus19/digital-voting-system-voxa-/blob/master/Backend/src/Services/emailService.ts"
click node_users "https://github.com/modulus19/digital-voting-system-voxa-/blob/master/Backend/src/Models/user.model.ts"
click node_otps "https://github.com/modulus19/digital-voting-system-voxa-/blob/master/Backend/src/Models/OTP.ts"
click node_pollcontroller "https://github.com/modulus19/digital-voting-system-voxa-/blob/master/Backend/src/Controllers/pollController.ts"
click node_pollservice "https://github.com/modulus19/digital-voting-system-voxa-/blob/master/Backend/src/Services/pollService.ts"
click node_pollmodel "https://github.com/modulus19/digital-voting-system-voxa-/blob/master/Backend/src/Models/poll.model.ts"
click node_votecontroller "https://github.com/modulus19/digital-voting-system-voxa-/blob/master/Backend/src/Controllers/voteController.ts"
click node_voteservice "https://github.com/modulus19/digital-voting-system-voxa-/blob/master/Backend/src/Services/voteService.ts"
click node_resultcontroller "https://github.com/modulus19/digital-voting-system-voxa-/blob/master/Backend/src/Controllers/resultController.ts"
click node_resultservice "https://github.com/modulus19/digital-voting-system-voxa-/blob/master/Backend/src/Services/resultService.ts"

classDef toneNeutral fill:#f8fafc,stroke:#334155,stroke-width:1.5px,color:#0f172a
classDef toneBlue fill:#dbeafe,stroke:#2563eb,stroke-width:1.5px,color:#172554
classDef toneAmber fill:#fef3c7,stroke:#d97706,stroke-width:1.5px,color:#78350f
classDef toneMint fill:#dcfce7,stroke:#16a34a,stroke-width:1.5px,color:#14532d
classDef toneRose fill:#ffe4e6,stroke:#e11d48,stroke-width:1.5px,color:#881337
classDef toneIndigo fill:#e0e7ff,stroke:#4f46e5,stroke-width:1.5px,color:#312e81
classDef toneTeal fill:#ccfbf1,stroke:#0f766e,stroke-width:1.5px,color:#134e4a
class node_routes,node_authpages,node_authcontext,node_pollpages,node_adminpages,node_authapi,node_apiclient,node_user toneBlue
class node_app,node_authroutes,node_pollroutes,node_voteroutes,node_resultroutes,node_authmw toneAmber
class node_authcontroller,node_authservice,node_otpservice,node_email,node_users,node_otps toneMint
class node_pollcontroller,node_pollservice,node_pollmodel toneRose
class node_votecontroller,node_voteservice,node_resultcontroller,node_resultservice,node_admin toneIndigo
```

## Components

### Web application

- [Page routing](https://github.com/modulus19/digital-voting-system-voxa-/blob/master/Frontend/src/routes/AppRoutes.jsx): `Frontend/src/routes/AppRoutes.jsx`
- [Account pages](https://github.com/modulus19/digital-voting-system-voxa-/tree/master/Frontend/src/pages/auth): `Frontend/src/pages/auth`
- [Auth context](https://github.com/modulus19/digital-voting-system-voxa-/blob/master/Frontend/src/context/AuthContext.jsx): `Frontend/src/context/AuthContext.jsx`
- [Poll pages](https://github.com/modulus19/digital-voting-system-voxa-/tree/master/Frontend/src/pages/user): `Frontend/src/pages/user`
- [Admin pages](https://github.com/modulus19/digital-voting-system-voxa-/tree/master/Frontend/src/pages/admin): `Frontend/src/pages/admin`
- [Auth API client](https://github.com/modulus19/digital-voting-system-voxa-/blob/master/Frontend/src/services/authApi.js): `Frontend/src/services/authApi.js`
- [API client](https://github.com/modulus19/digital-voting-system-voxa-/blob/master/Frontend/src/services/api.js): `Frontend/src/services/api.js`

### API and access

- [Express application](https://github.com/modulus19/digital-voting-system-voxa-/blob/master/Backend/src/app.ts): `Backend/src/app.ts`
- [Auth routes](https://github.com/modulus19/digital-voting-system-voxa-/blob/master/Backend/src/Routes/authRoutes.ts): `Backend/src/Routes/authRoutes.ts`
- [Poll routes](https://github.com/modulus19/digital-voting-system-voxa-/blob/master/Backend/src/Routes/pollRoutes.ts): `Backend/src/Routes/pollRoutes.ts`
- [Vote routes](https://github.com/modulus19/digital-voting-system-voxa-/blob/master/Backend/src/Routes/voteRoutes.ts): `Backend/src/Routes/voteRoutes.ts`
- [Result routes](https://github.com/modulus19/digital-voting-system-voxa-/blob/master/Backend/src/Routes/resultRoutes.ts): `Backend/src/Routes/resultRoutes.ts`
- [JWT authentication](https://github.com/modulus19/digital-voting-system-voxa-/blob/master/Backend/src/Middleware/auth.ts): `Backend/src/Middleware/auth.ts`

### Identity

- [Auth controller](https://github.com/modulus19/digital-voting-system-voxa-/blob/master/Backend/src/Controllers/authController.ts): `Backend/src/Controllers/authController.ts`
- [Account service](https://github.com/modulus19/digital-voting-system-voxa-/blob/master/Backend/src/Services/authService.ts): `Backend/src/Services/authService.ts`
- [OTP service](https://github.com/modulus19/digital-voting-system-voxa-/blob/master/Backend/src/Services/otpService.ts): `Backend/src/Services/otpService.ts`
- [Email delivery](https://github.com/modulus19/digital-voting-system-voxa-/blob/master/Backend/src/Services/emailService.ts): `Backend/src/Services/emailService.ts`
- [User records](https://github.com/modulus19/digital-voting-system-voxa-/blob/master/Backend/src/Models/user.model.ts): `Backend/src/Models/user.model.ts`
- [OTP records](https://github.com/modulus19/digital-voting-system-voxa-/blob/master/Backend/src/Models/OTP.ts): `Backend/src/Models/OTP.ts`

### Poll lifecycle

- [Poll controller](https://github.com/modulus19/digital-voting-system-voxa-/blob/master/Backend/src/Controllers/pollController.ts): `Backend/src/Controllers/pollController.ts`
- [Poll service](https://github.com/modulus19/digital-voting-system-voxa-/blob/master/Backend/src/Services/pollService.ts): `Backend/src/Services/pollService.ts`
- [Poll records](https://github.com/modulus19/digital-voting-system-voxa-/blob/master/Backend/src/Models/poll.model.ts): `Backend/src/Models/poll.model.ts`

### Voting and results

- [Vote controller](https://github.com/modulus19/digital-voting-system-voxa-/blob/master/Backend/src/Controllers/voteController.ts): `Backend/src/Controllers/voteController.ts`
- [Vote service](https://github.com/modulus19/digital-voting-system-voxa-/blob/master/Backend/src/Services/voteService.ts): `Backend/src/Services/voteService.ts`
- [Result controller](https://github.com/modulus19/digital-voting-system-voxa-/blob/master/Backend/src/Controllers/resultController.ts): `Backend/src/Controllers/resultController.ts`
- [Result service](https://github.com/modulus19/digital-voting-system-voxa-/blob/master/Backend/src/Services/resultService.ts): `Backend/src/Services/resultService.ts`

### Other components

- **User**
- **Administrator**

## Connections

- User → Page routing: uses
- Administrator → Page routing: uses
- Page routing → Account pages: routes to (evidence: `Frontend/src/routes/AppRoutes.jsx`)
- Page routing → Poll pages: routes to (evidence: `Frontend/src/routes/AppRoutes.jsx`)
- Page routing → Admin pages: routes to (evidence: `Frontend/src/routes/AppRoutes.jsx`)
- Account pages → Auth API client: calls (evidence: `Frontend/src/pages/auth/Register.jsx`)
- Auth context → Auth API client: calls (evidence: `Frontend/src/context/AuthContext.jsx`)
- Auth API client → API client: uses (evidence: `Frontend/src/services/authApi.js`)
- API client → Express application: HTTP requests
- Express application → Auth routes: mounts (evidence: `Backend/src/app.ts`)
- Express application → Poll routes: mounts (evidence: `Backend/src/app.ts`)
- Express application → Vote routes: mounts (evidence: `Backend/src/app.ts`)
- Express application → Result routes: mounts (evidence: `Backend/src/app.ts`)
- Auth routes → Auth controller: dispatches (evidence: `Backend/src/Routes/authRoutes.ts`)
- Poll routes → JWT authentication: authenticates (evidence: `Backend/src/Routes/pollRoutes.ts`)
- Poll routes → Poll controller: dispatches (evidence: `Backend/src/Routes/pollRoutes.ts`)
- Vote routes → JWT authentication: authenticates (evidence: `Backend/src/Routes/voteRoutes.ts`)
- Result routes → JWT authentication: authenticates (evidence: `Backend/src/Routes/resultRoutes.ts`)
- Auth controller → Account service: calls (evidence: `Backend/src/Controllers/authController.ts`)
- Auth controller → OTP service: calls (evidence: `Backend/src/Controllers/authController.ts`)
- Account service → User records: reads and writes (evidence: `Backend/src/Services/authService.ts`)
- Account service → OTP service: requests verification (evidence: `Backend/src/Services/authService.ts`)
- OTP service → OTP records: reads and writes (evidence: `Backend/src/Services/otpService.ts`)
- OTP service → User records: reads and updates (evidence: `Backend/src/Services/otpService.ts`)
- OTP service → Email delivery: sends codes (evidence: `Backend/src/Services/otpService.ts`)
- Poll controller → Poll service: calls (evidence: `Backend/src/Controllers/pollController.ts`)
- Poll service → Poll records: reads and writes (evidence: `Backend/src/Services/pollService.ts`)
- Vote controller → Vote service: calls (evidence: `Backend/src/Controllers/voteController.ts`)
- Result controller → Result service: calls (evidence: `Backend/src/Controllers/resultController.ts`)
