LINK π : https://govtrack-government-document-request.ai.studio/
Notice: Demo / Prototype β Not an Official Government Website. Built to demonstrate full end-to-end digitisation of citizen certificate issuance, multi-department verification, and real-time status tracking.
In conventional public administration, citizens submit requests for statutory certificates (Income, Domicile, Caste, Birth, Senior Citizen cards) and subsequently must physically visit the revenue or municipal office multiple times just to know whether their file is pending, under desk scrutiny, awaiting field verification, approved, or ready for collection. This causes congestion at public offices, delays, lack of accountability, and citizen frustration.
GovTrack digitizes the complete lifecycle:
- Citizens submit structured applications online with supporting document uploads (Aadhaar, utility bills, salary proofs).
- System auto-assigns an immutable tracking number (e.g.
GOV-2026-000001) and calculates statutory SLA dates. - Departmental Officers inspect proofs, approve or reject individual documents with remarks, request supplementary files, and transition status along a strictly audited workflow pipeline.
- Citizens & Public track real-time progress via a vertical status stepper and audit log, eliminating redundant physical visits.
- Final certified documents are cryptographically generated, digitally stored, and securely downloadable.
ββββββββββββββββββββββββββββββββββββββββββ
β GovTrack React Frontend (Vite) β
β - Tailwind CSS - Lucide Icons β
β - Recharts Dashboard - Auth Context β
ββββββββββββββββββββ¬ββββββββββββββββββββββ
β HTTP / JSON / FormData
βΌ
ββββββββββββββββββββββββββββββββββββββββββ
β Express.js Backend API Server β
β - JWT Authentication - RBAC β
β - Multer Secure Uploads β
β - Status Workflow Validator β
ββββββββ¬βββββββββββββββββββββββββββ¬βββββββ
β β
βΌ βΌ
βββββββββββββββββββββββββββββββββ βββββββββββββββββββββββββββββββββββββ
β Persistence Document Store β β Government Integration Gateway β
β - MongoDB (Mongoose Schema) β β (DigiLocker / e-District / SMS) β
β - Zero-Config Embedded Store β β GovernmentDocumentService.ts β
βββββββββββββββββββββββββββββββββ βββββββββββββββββββββββββββββββββββββ
- Frontend: React 19, Vite, React Router DOM, Tailwind CSS, Lucide React, Recharts.
- Backend: Node.js, Express.js, TypeScript, Multer, JWT, Bcryptjs, Cors.
- Database / Storage: Dual-mode MongoDB/Mongoose connection manager with embedded disk-backed JSON persistence fallback (
data/govtrack_db.json) for seamless zero-setup execution.
govtrack/
βββ data/ # Persistent database store
β βββ govtrack_db.json
βββ uploads/ # Secure document storage
βββ server/
β βββ config/
β β βββ db.ts # MongoDB & persistence connection manager
β βββ controllers/
β β βββ adminController.ts # Admin analytics, processing, verification
β β βββ authController.ts # Register, login, profile, me
β β βββ documentTypeController.ts # Master document catalog
β β βββ notificationController.ts # Citizen notification system
β β βββ publicController.ts # Public status tracking & catalog
β β βββ requestController.ts # Application filing, cancellation, downloads
β βββ middleware/
β β βββ auth.ts # JWT authentication token verification
β β βββ role.ts # Role-Based Access Control (RBAC)
β β βββ upload.ts # Multer MIME & size validation (5MB max)
β β βββ errorHandler.ts # Centralized exception formatter
β βββ models/
β β βββ index.ts # User, DocumentType, Request, History, Notification, AuditLog
β βββ routes/
β β βββ adminRoutes.ts
β β βββ authRoutes.ts
β β βββ documentTypeRoutes.ts
β β βββ notificationRoutes.ts
β β βββ publicRoutes.ts
β β βββ requestRoutes.ts
β βββ seed/
β β βββ seedData.ts # Demo users, 10 document types, sample applications
β βββ services/
β β βββ statusWorkflow.ts # State transition rules engine
β β βββ government/
β β βββ GovernmentDocumentService.ts # External API integration adapter
β βββ tests/
β β βββ api.test.ts # Automated RBAC, IDOR, transition test suite
β βββ utils/
β β βββ jwt.ts
β β βββ password.ts
β β βββ requestNumber.ts # Auto-generates GOV-YYYY-XXXXXX
β βββ app.ts # Express application configuration
βββ src/
β βββ components/
β β βββ Footer.tsx
β β βββ Modal.tsx
β β βββ Navbar.tsx
β β βββ Pagination.tsx
β β βββ StatusBadge.tsx
β β βββ TimelineView.tsx # Vertical progress stepper & history log
β βββ context/
β β βββ AuthContext.tsx # User session, login, quick demo switchers
β βββ pages/
β β βββ admin/
β β β βββ AdminAuditLogsPage.tsx
β β β βββ AdminDashboard.tsx # Recharts analytics & live queue
β β β βββ AdminDocumentTypesPage.tsx
β β β βββ AdminProcessRequestPage.tsx # Split-screen review workstation
β β β βββ AdminProfilePage.tsx
β β β βββ AdminRequestsPage.tsx # Search, filter, pagination
β β β βββ AdminUsersPage.tsx
β β βββ auth/
β β β βββ LoginPage.tsx
β β β βββ RegisterPage.tsx
β β βββ citizen/
β β β βββ ApplyDocumentPage.tsx # 4-step dynamic application wizard
β β β βββ CitizenDashboard.tsx
β β β βββ CitizenProfilePage.tsx
β β β βββ MyRequestsPage.tsx
β β β βββ NotificationsPage.tsx
β β β βββ RequestDetailsPage.tsx
β β βββ public/
β β βββ LandingPage.tsx
β β βββ ServicesPage.tsx
β β βββ TrackRequestPage.tsx # Public tracking by reference number
β βββ routes/
β β βββ AppRoutes.tsx # ProtectedRoute & RoleProtectedRoute
β βββ services/
β β βββ adminService.ts
β β βββ api.ts
β β βββ authService.ts
β β βββ documentTypeService.ts
β β βββ notificationService.ts
β β βββ publicService.ts
β β βββ requestService.ts
β βββ types/
β β βββ index.ts
β βββ App.tsx
β βββ main.tsx
βββ .env.example
βββ package.json
βββ server.ts # Full-stack entry point (Express + Vite)
βββ tsconfig.json
βββ vite.config.ts
Status transitions are enforced by server/services/statusWorkflow.ts:
[ SUBMITTED ]
β
βββββββββββββββ΄ββββββββββββββ
βΌ βΌ
[ CANCELLED ] [ UNDER_REVIEW ]
(by citizen) β
βΌ
[ DOCUMENT_VERIFICATION ]
β
ββββββββββββββββββββββΌβββββββββββββββββββββ
βΌ βΌ βΌ
[ REJECTED ] [ ADDITIONAL_DOCUMENT_REQUIRED ] [ PROCESSING ]
(with reason) β β
β (after upload) βΌ
ββββββββββββββββ> [ APPROVED ]
β
βΌ
[ READY_FOR_DOWNLOAD ]
β
βΌ
[ COMPLETED ]
Every status update:
- Validates that the transition is legal.
- Updates the
Requestrecord. - Appends to
RequestStatusHistorywith the actor, timestamp, and official remarks. - Dispatches an in-portal
Notificationto the citizen. - Records an entry in the immutable
AuditLog.
The application is pre-seeded with realistic demonstration data for immediate review.
| Role | Name | Password | Pre-Seeded Requests | |
|---|---|---|---|---|
| Officer (Admin) | Vikram Sharma | admin@govtrack.demo |
Admin@123456 |
Full administrative oversight |
| Citizen (Rahul) | Rahul Patel | citizen@govtrack.demo |
Citizen@123456 |
GOV-2026-000001 (Ready), GOV-2026-000002 (Verification), GOV-2026-000005 (Submitted), GOV-2026-000006 (Rejected) |
| Citizen (Priya) | Priya Deshmukh | priya.deshmukh@govtrack.demo |
Citizen@123456 |
GOV-2026-000003 (Doc Needed), GOV-2026-000004 (Completed) |
Tip: You can use the 1-Click "Demo Switcher" buttons located in the top navigation bar to test both citizen and officer roles without typing passwords.
- Node.js
$\ge 18.0.0$ - npm
$\ge 9.0.0$
git clone <repo-url>
cd govtrack
npm installCopy .env.example to .env:
cp .env.example .envDefault .env configuration:
PORT=3000
MONGO_URI=mongodb://localhost:27017/govtrack
JWT_SECRET=super_secret_jwt_key_govtrack_2026
JWT_EXPIRES_IN=7d
REFRESH_TOKEN_SECRET=super_refresh_jwt_key_govtrack_2026
CLIENT_URL=http://localhost:3000
UPLOAD_DIR=./uploads
GOVERNMENT_API_BASE_URL=https://api.digitallocker.gov.in/v1
GOVERNMENT_API_KEY=sample_gov_api_key_demo
VITE_API_URL=/api(Note: If a local MongoDB instance is not running, GovTrack automatically falls back to its built-in persistent document store in data/govtrack_db.json. No external database setup is required to evaluate the portal!)
npm run devNavigate to http://localhost:3000.
GovTrack includes automated tests verifying RBAC, IDOR prevention, and workflow transitions:
npm testnpm run build
npm startPOST /api/auth/registerβ Register new citizen account.POST /api/auth/loginβ Sign in and receive JWT token.GET /api/auth/meβ Retrieve current authenticated user profile.PATCH /api/auth/profileβ Update contact & address information.POST /api/auth/logoutβ End user session.
GET /api/document-typesβ List all active statutory certificates.GET /api/document-types/:idβ Get document type with required proofs list.POST /api/document-typesβ Create document type (Admin).PUT /api/document-types/:idβ Update document type (Admin).PATCH /api/document-types/:id/statusβ Toggle active status (Admin).
POST /api/requestsβ Submit application with multipart proofs.GET /api/requests/myβ List citizen's applications with pagination.GET /api/requests/:idβ View application details (Enforces IDOR ownership check).PATCH /api/requests/:id/cancelβ Cancel request (Permitted only atSUBMITTEDstage).POST /api/requests/:id/documentsβ Upload additional document requested by officer.GET /api/requests/:id/documents/:docId/downloadβ Secure authenticated file download.GET /api/requests/:id/final-document/downloadβ Download issued digital certificate.
GET /api/admin/dashboardβ Live counts, status breakdown, Recharts series.GET /api/admin/requestsβ Filterable, sortable, paginated request queue.GET /api/admin/requests/:idβ Full dossier for processing.PATCH /api/admin/requests/:id/statusβ Update stage with remarks.PATCH /api/admin/requests/:id/documents/:docId/verifyβ Verify or reject proof.POST /api/admin/requests/:id/additional-documentβ Request additional proof.POST /api/admin/requests/:id/final-documentβ Issue and attach signed certificate.GET /api/admin/usersβ Manage citizen and officer accounts.PATCH /api/admin/users/:id/statusβ Deactivate / activate user.GET /api/admin/audit-logsβ Immutable audit ledger.
GET /api/public/track/:requestNumberβ Public status tracking and milestone timeline (applicant name masked for privacy).GET /api/public/document-typesβ Public certificate catalog.
- IDOR Protection: Citizens can only query their own applications (
request.citizen === req.user._id). Attempting to manipulate IDs returns403 Forbidden. - Role-Based Access Control (RBAC): All administrative endpoints are guarded by
authorizeRoles('admin'). - Private File Storage: Uploaded proofs are stored outside public web roots and accessed exclusively via authenticated streaming endpoints.
- Input Sanitization: File uploads are restricted to
.pdf,.jpg,.jpeg, and.pngwith strict 5MB size limits. - Workflow Integrity: Status transitions cannot skip required phases; direct jumps are rejected by the workflow state machine.
The codebase is engineered with clear enterprise extension points:
- DigiLocker Integration: Connects to the National DigiLocker API to automatically pull Aadhaar XML or secondary school certificates rather than asking citizens to manually scan documents.
- e-Pramaan / National Single Sign-On (NSSO):
OAuth2 endpoints in
server/routes/authRoutes.tscan be wired directly to state identity gateways. - SMS / WhatsApp Gateway:
In
server/controllers/adminController.ts, notifications can trigger an SMS payload via CDAC Mobile Seva or Twilio. - Digital Signature (e-Sign):
uploadFinalDocumentcan route through Aadhaar-based e-Sign (C-DAC / NSDL) to embed cryptographic digital signature certificates directly into the generated PDF.
The repository keeps browser code and API code separate while grouping each by responsibility:
src/pages/contains route-level screens, grouped by public, citizen, administrator, and authentication flows.src/components/contains shared UI;src/context/owns cross-page session state.src/services/is the frontend API boundary, andsrc/types/holds shared client-side types.server/routes/maps HTTP endpoints,server/controllers/handles requests, andserver/services/contains reusable workflow and integration logic.server/models/provides the persistence boundary, with database setup inserver/config/; middleware and small utilities remain separately scoped.server/tests/contains API-level regression coverage. Keep new tests close to their existing server or client feature area.
Prefer extending these boundaries over moving files or duplicating request logic. Keep route/controller changes paired with the corresponding frontend service and API test when behavior changes.
The server and API test entry point load .env automatically. Copy .env.example to .env for local configuration; set JWT_SECRET to a private value of at least 32 characters before production use. Do not use the publicly visible demo secret shown in the earlier setup example. Development runs without a configured secret use a temporary random key, so existing login tokens become invalid after a server restart.
UPLOAD_DIR controls where private uploaded files are stored and defaults to ./uploads; this runtime directory is excluded from Git. VITE_API_URL controls the frontend API base and defaults to /api. The JSON data file under data/ is demonstration/runtime state, not a production database or a safe location for real citizen information.
bun.lock is the checked-in dependency lockfile. Use Bun for reproducible dependency resolution, and avoid committing a second package-manager lockfile. The equivalent locked setup and checks are:
bun install --frozen-lockfile
bun run lint
bun run test
bun run buildThe npm scripts listed in the setup section remain available when using npm. For API changes, include regression coverage for authorization, ownership, validation, and status transitions as applicable. Keep credentials, real personal information, uploaded documents, and generated runtime data out of commits. This prototype is not approved for processing real government applications or sensitive citizen information.