Civic Samadhan is a role-based civic issue platform where citizens can report local problems, admins can manage issue flow, and workers can receive and complete assignments.
This repository contains:
- A TypeScript + Express backend API with PostgreSQL
- A React Native (Expo) mobile app for citizen, admin, and worker experiences
- Image verification/classification support (Gemini-assisted when configured)
- Reward points and wallet tracking for issue resolution
tic2k26-truecoding/
backend/ # Express API + PostgreSQL bootstrap/migrations
mobile/ # Expo app (citizen/admin/worker flows)
- Register/login and manage profile state in app
- Report issues with image + location
- Auto-verify uploaded issue images before final submission
- Browse nearby issues, filter by status/category, and upvote
- Track issue timeline and verify resolution
- Dashboard stats for queue health and resolution rate
- Create worker accounts (worker self-registration is blocked)
- Assign workers and manage issue lifecycle
- Track high-priority and unresolved issues
- Login with admin-provisioned account
- Complete verification + onboarding details
- Accept/reject assignments
- Submit in-progress/completed field reports (with optional image)
- Reporter reward points on resolution
- Worker reward and on-time bonus points
- Wallet value derived from
POINT_TO_MONEY_RATE
- Backend: Node.js, TypeScript, Express, PostgreSQL, JWT, bcrypt, pino
- Mobile: Expo 54, React Native, Expo Router, React Query
- AI/Verification:
@google/genai(optional viaGEMINI_API_KEY)
- Node.js 20+
- npm
- PostgreSQL instance reachable from backend
cd backend
copy .env.example .env
npm install
npm run devThe API starts on http://localhost:3001 by default, and routes are under /api.
Health check:
GET /api/healthz
Create backend/.env from backend/.env.example and set values:
PORT: API port (default3001)DATABASE_URL: PostgreSQL connection string (required)JWT_SECRET: JWT signing secretCORS_ORIGIN: Allowed origins (*for local development)UPLOAD_DIR: Local upload directoryADMIN_NAME: Seed admin display nameADMIN_EMAIL: Seed admin emailADMIN_PASSWORD: Seed admin passwordGEMINI_API_KEY: Optional key for Gemini-powered image analysisPOINT_TO_MONEY_RATE: Conversion rate from points to wallet amount
- Database schema bootstraps automatically at startup.
- If
ADMIN_EMAILandADMIN_PASSWORDare set, an admin account is seeded once. - Uploaded images are served from
/api/uploads/....
cd mobile
npm installSet backend URL before starting Expo (PowerShell example):
$env:EXPO_BACKEND_URL="http://<your-machine-ip>:3001"Start app:
npm run startOptional targets:
npm run android
npm run ios
npm run webNotes:
EXPO_BACKEND_URLis consumed by Expo config.- API client automatically normalizes base URL to include
/api. - For physical devices, use your LAN IP (not
localhost) for backend URL.
npm run dev: Run withtsx watchnpm run start: Run once withtsxnpm run typecheck: TypeScript checks
npm run start: Start Expo dev servernpm run android: Launch Android targetnpm run ios: Launch iOS targetnpm run web: Launch web targetnpm run lint: Expo lintnpm run typecheck: TypeScript checks
Base path: /api
- Health:
/healthz - Auth:
POST /auth/registerPOST /auth/loginGET /auth/mePOST /auth/worker-loginPOST /auth/worker-verify
- Issues:
GET /issues,GET /issues/map,GET /issues/:idPOST /issues(create)POST /issues/verify-imagePATCH /issues/:id(admin)POST /issues/:id/upvotePOST /issues/:id/verify-resolutionGET /issues/:id/timeline
- Admin:
GET /admin/statsGET /admin/workersPOST /admin/workers
- Workers:
GET /workers/nearbyPOST /workers/me/onboardingGET /workers/me/assignmentsPOST /workers/issues/:id/assignment-responsePOST /workers/issues/:id/reports
- Upload + classify:
POST /uploadPOST /classify
- Start PostgreSQL and confirm
DATABASE_URLworks. - Run backend (
npm run dev) and verifyGET /api/healthz. - Set
EXPO_BACKEND_URLfor mobile. - Run mobile (
npm run start) and open app on simulator/device. - Log in as seeded admin to create worker accounts.
- Change
JWT_SECRETand admin default credentials for any shared or production environment. - Restrict
CORS_ORIGINin non-local deployments. - Protect and rotate
GEMINI_API_KEYif enabled.