How divyanshu-hash/resolvex works
1. Overall shape
ResolveX is a split frontend/backend system: a React single-page app for users and admins, a FastAPI service for business logic and API access, and a MySQL database as the system of record. There is also a filesystem upload area for complaint evidence.
2. Client layer
The frontend is a Vite + React 18 app using React Router, Axios, and Tailwind CSS. Its main architectural role is presentation and session-aware navigation: AuthContext holds login state, App.tsx wires routes and role guards, and Layout/Sidebar provide the shared shell. Pages map directly to product workflows such as dashboard, complaint creation, complaint detail, analytics, users, login, and registration.
3. API layer
The backend is a FastAPI application composed of route modules under backend/routers. Each router owns a functional slice of the domain: auth, complaints, evidence, feedback, analytics, and users. This keeps the API boundary clear and makes it easy to diagram as a set of resource-oriented endpoints behind a single app entrypoint in main.py.
4. Identity and access control
Authentication is JWT-based with role checks enforced server-side through dependencies.py. The system is explicitly role-driven: normal user, staff, admin, and super admin. The frontend mirrors this with protected routes and conditional menu visibility, but the backend is the source of truth for authorization.
5. Complaint workflow core
The complaint subsystem is the central domain flow. Complaints move through a lifecycle from submission to categorization, assignment, progress, resolution, and closure. The complaint router and related services handle state changes, assignment, and audit logging, while the UI exposes both list and detail views for tracking.
6. Automation services
Several backend services add automation around the core workflow. categorization.py infers category and priority from complaint text, escalation.py handles overdue complaint escalation via a scheduled job, and complaint_log.py writes timeline/audit entries. main.py is responsible for wiring the scheduler into the app lifecycle.
7. Evidence handling
Evidence is a separate subsystem because it mixes metadata and file storage. The API lets users upload and retrieve images/PDFs tied to a complaint; metadata is stored in MySQL while the actual files land in the configured upload directory on disk. This creates a clear boundary between transactional data and binary assets.
8. Feedback and closure
Feedback is only meaningful after resolution, so it sits downstream of the complaint lifecycle. The feedback endpoints let users rate completed complaints, creating a post-resolution signal that can be used for accountability and reporting. This is a lightweight but distinct subdomain.
9. Analytics and reporting
The analytics module is read-heavy and aggregates operational metrics such as total/open/resolved/escalated complaints, trends by category/priority/month, and staff performance. The frontend Analytics page renders these metrics with charts, so the diagram should show analytics as a backend query/aggregation path feeding a dedicated dashboard view.
10. Persistence model
MySQL is the primary persistent store, with schema defined in database/schema.sql and ORM models in backend/models.py. SQLAlchemy provides the data-access layer, while Pydantic schemas define API contracts. This gives a clean separation between transport models, ORM entities, and database schema.
11. Operational bootstrap and data seeding
backend/config.py reads environment-driven settings such as database URL, JWT secret, upload path, SLA timing, and escalation toggle. There is also a seed/migration path in the backend and a SQL schema file for initial setup, indicating the repo supports both direct schema initialization and app-level bootstrapping.
12. Key external boundaries
The important architectural boundaries are: browser to SPA, SPA to FastAPI over HTTP, FastAPI to MySQL via SQLAlchemy, and FastAPI to the local upload directory for evidence files. Background escalation is the main non-request-driven flow, so it should be drawn as a scheduler-triggered backend process that mutates complaint state independently of user traffic.
Main entry points: App.tsx App shell · complaints.py Complaints API · __init__.py Routers · schema.sql MySQL
Components 27
Frontend
React SPA for users and admins.
- App shell · Bootstraps routing, guards, and top-level UI composition.
frontend/src/App.tsx - Auth state · Holds login/session state for the SPA.
frontend/src/context/AuthContext.tsx - Layout · Shared page structure for authenticated views.
frontend/src/components/Layout.tsx - Sidebar · Role-aware navigation menu and section links.
frontend/src/components/Sidebar.tsx - Dashboard · Primary landing view for operational status.
frontend/src/pages/Dashboard.tsx - Complaints · Lists complaints and routes into detail views.
frontend/src/pages/ComplaintsList.tsx - New complaint · Creates complaint submissions from users.
frontend/src/pages/ComplaintCreate.tsx - Complaint detail · Shows complaint state, history, and related evidence.
frontend/src/pages/ComplaintDetail.tsx - Analytics · Renders charts and metrics for reporting.
frontend/src/pages/Analytics.tsx - Users · Admin view for user management.
frontend/src/pages/Users.tsx - Login · Authentication entry point for existing users.
frontend/src/pages/Login.tsx - Register · Account creation flow for new users.
frontend/src/pages/Register.tsx
Backend
FastAPI service with domain routers and automation.
- API app · Wires routers, lifecycle hooks, and scheduler startup.
backend/main.py - Access control · Server-side JWT and role enforcement helpers.
backend/dependencies.py - Routers · Resource-oriented HTTP endpoints grouped by domain.
backend/routers/__init__.py - Complaints API · Complaint submission, lifecycle updates, assignment, and audit flow.
backend/routers/complaints.py - Evidence API · Uploads and retrieves complaint attachments.
backend/routers/evidence.py - Feedback API · Captures post-resolution user feedback.
backend/routers/feedback.py - Analytics API · Aggregates operational metrics for dashboards.
backend/routers/analytics.py - Users API · User and staff administration endpoints.
backend/routers/users.py - Auth API · Login, registration, and token issuance endpoints.
backend/routers/auth.py - Categorization · Infers complaint category and priority from text.
backend/services/categorization.py - Escalation · Scheduler-driven overdue complaint escalation logic.
backend/services/escalation.py - Complaint log · Writes timeline and audit trail entries.
backend/services/complaint_log.py - Config · Environment-driven application settings.
backend/config.py
Connections 40
- App shell → Auth state: uses session · App shell reads authentication state for guards and navigation.
- App shell → Layout: renders shell · Top-level app composes the shared authenticated layout.
- Layout → Sidebar: includes nav · Layout embeds the main navigation sidebar.
- App shell → Login: routes to · Public route for sign-in.
- App shell → Register: routes to · Public route for account creation.
- App shell → Dashboard: routes to · Authenticated landing page.
- App shell → Complaints: routes to · Complaint listing workflow.
- App shell → New complaint: routes to · Complaint submission workflow.
- App shell → Complaint detail: routes to · Complaint inspection workflow.
- App shell → Analytics: routes to · Reporting dashboard route.
- App shell → Users: routes to · Admin-only user management route.
- API app → Routers: mounts · Main application registers domain routers.
- API app → Access control: enforces · API routes rely on shared auth and role checks.
- API app → Config: reads settings · Bootstrapping uses environment-driven configuration.
- Routers → Auth API: includes · Authentication endpoints.
- Routers → Complaints API: includes · Complaint lifecycle endpoints.
- Routers → Evidence API: includes · Attachment upload and retrieval endpoints.
- Routers → Feedback API: includes · Post-resolution feedback endpoints.
- Routers → Analytics API: includes · Operational metrics endpoints.
- Routers → Users API: includes · User administration endpoints.
- Complaints API → Categorization: uses · Complaint intake can infer category and priority.
- Complaints API → Complaint log: writes · State changes and assignments create audit entries.
- Complaints API → Escalation: updates via · Overdue complaints are escalated by background processing.
- Feedback API → Complaints API: depends on · Feedback is tied to resolved complaints.
- Evidence API → Uploads: stores files · Binary evidence is saved to local disk.
- Evidence API → MySQL: stores metadata · Attachment metadata persists in the database.
- Auth API → MySQL: reads/writes · Credentials and user records live in MySQL.
- Users API → MySQL: reads/writes · User administration persists to MySQL.
- Complaints API → MySQL: reads/writes · Complaint records, status, and assignments persist to MySQL.
- Feedback API → MySQL: reads/writes · Feedback records persist to MySQL.
- Analytics API → MySQL: queries · Aggregations are computed from stored operational data.
- Escalation → MySQL: mutates · Escalation job updates complaint state in storage.
- Analytics → Analytics API: fetches metrics · Analytics view consumes aggregated backend metrics.
- Complaints → Complaints API: fetches complaints · List view reads complaint collections.
- New complaint → Complaints API: submits · Create form posts new complaints.
- Complaint detail → Complaints API: fetches detail · Detail view loads complaint state and history.
- Complaint detail → Evidence API: uploads evidence · Detail view can attach complaint evidence.
- Login → Auth API: authenticates · Login exchanges credentials for a session token.
- Register → Auth API: registers · Registration creates a new account through the auth API.
- Users → Users API: administers · Users page manages staff and user accounts.