How arn101/jonomot works
Purpose and deployment shape
Jonomot is a Bangladesh citizen-opinion and government/organization feedback portal. It is a React SPA backed by a Laravel JSON API: browser requests use Sanctum Bearer tokens, while Laravel persists domain data in MySQL (or SQLite locally) and exposes uploaded media from public storage. Main runtime entry points are frontend/src/main.jsx, frontend/src/App.jsx, backend/public/index.php, and backend/routes/api.php.
SPA composition and navigation
The frontend owns the product UI and calls only /api/* through its centralized Axios client. Route-level views cover public feed/login plus authenticated profile, polls, ministry inbox, and admin dashboard. Auth state, persisted token handling, localization, and notifications are application-wide contexts; role gates protect privileged views.
Paths: frontend/src/api/client.js, frontend/src/context/AuthContext.jsx, frontend/src/components/RoleRoute.jsx, frontend/src/views/Feed.jsx, frontend/src/views/AdminPanel.jsx.
API boundary, authentication, and hardening
Laravel routes requests to API controllers by domain. Registration/login issue Sanctum personal-access tokens; later calls use auth:sanctum. Custom role and NID-verification middleware enforce capability boundaries, while sanitization/security middleware and route throttles defend writes. The frontend stores the token as jonomot_token.
Paths: backend/routes/api.php, backend/app/Http/Controllers/Api/AuthController.php, backend/app/Http/Middleware/RoleMiddleware.php, backend/app/Http/Middleware/NidVerifiedMiddleware.php.
Civic reporting and ministry workflow
Posts are the central feedback artifact: citizens create categorized reports with optional images, then users can vote, save, comment, and report them. Posts can be tagged to ministries through the post–ministry relationship; ministry users consume a dedicated inbox, star posts, and post official responses. Admins review reports/flagged posts and restore moderated content.
Paths: backend/app/Http/Controllers/Api/PostController.php, backend/app/Http/Controllers/Api/CommentController.php, backend/app/Http/Controllers/Api/AdminController.php, backend/app/Models/Post.php.
Surveys, eligibility, and reward accounting
Organizations and admins create/manage polls with options, demographic filters, closure, analytics/results, and reward-point values. Only NID-verified citizens vote; eligibility includes normalized division and age filtering. A successful response records poll participation and credits the points ledger. Payment endpoints/views support the survey-payment surface, though polls may operate as free.
Paths: backend/app/Http/Controllers/Api/PollController.php, backend/app/Models/Poll.php, backend/app/Models/PollResponse.php, backend/app/Models/PointsLedger.php, backend/app/Http/Controllers/Api/PaymentController.php.
Identity, organizations, and verification
A shared user model represents citizens, ministries, companies, and admins. Ministry/company detail models hold organization profiles and approval state; admins approve pending organizations. Citizen NID verification is a local mock service, but gates civic publishing and poll voting, making it a replaceable external-integration boundary.
Paths: backend/app/Models/User.php, backend/app/Models/MinistryDetail.php, backend/app/Models/CompanyDetail.php, backend/app/Services/NidVerificationService.php.
Persistence, media, and infrastructure
Laravel migrations define users, organization profiles, posts/interactions, polls/responses, ledger, cache/jobs, and Sanctum tokens. MySQL 8 is the intended production database; Laravel supports database-backed cache/session/queue settings. Post images and avatars use Laravel’s public disk and require the storage:link symlink. Vite serves/builds the React application.
Paths: backend/database/migrations/2026_07_10_173139_create_profiles_tables.php, backend/database/migrations/2026_07_10_173140_create_posts_and_interactions_tables.php, backend/database/migrations/2026_07_10_173140_create_polls_and_ledgers_tables.php, backend/storage/app/public.
Main entry points: RoleMiddleware.php Access gates · User.php Users & organizations · Post.php Posts & interactions · main.jsx SPA entry & routes
Components 19
React SPA
- SPA entry & routes
frontend/src/main.jsx - Central API client · Sends all application requests to /api/*.
frontend/src/api/client.js - Auth & app state · Persists the jonomot_token and provides shared session state.
frontend/src/context/AuthContext.jsx - Role-gated views
frontend/src/components/RoleRoute.jsx - Feed & civic views · Public feed, profile, polls, and ministry inbox.
frontend/src/views/Feed.jsx - Admin dashboard
frontend/src/views/AdminPanel.jsx
Laravel API
- API routes · Maps JSON endpoints and applies throttling.
backend/routes/api.php - Authentication API · Registration and login issue Sanctum personal-access tokens.
backend/app/Http/Controllers/Api/AuthController.php - Access gates · Sanctum auth plus role and NID-verification capability checks.
backend/app/Http/Middleware/RoleMiddleware.php - Post & comment API · Creates reports and handles interactions, comments, ministry responses, and moderation reports.
backend/app/Http/Controllers/Api/PostController.php - Poll & payment API · Manages polls, eligibility, responses, rewards, and payment endpoints.
backend/app/Http/Controllers/Api/PollController.php - Administration API · Reviews flagged content and approves organizations.
backend/app/Http/Controllers/Api/AdminController.php
Civic domain
- Users & organizations · Shared users plus ministry and company profiles with approval state.
backend/app/Models/User.php - NID verification · Local mock integration that gates civic publishing and poll voting.
backend/app/Services/NidVerificationService.php - Posts & interactions · Categorized citizen reports linked to ministries, votes, saves, comments, and flags.
backend/app/Models/Post.php - Polls & reward ledger · Poll responses record participation and credit reward points.
backend/app/Models/PollResponse.php
Persistence & media
- MySQL / SQLite · Stores users, organizations, posts, polls, ledger, Sanctum tokens, and runtime tables.
backend/database/migrations/2026_07_10_173140_create_polls_and_ledgers_tables.php - Public media disk · Serves post images and avatars through Laravel public storage.
backend/storage/app/public
Other components
- Citizen & staff browsers
Connections 25
- Citizen & staff browsers → SPA entry & routes: loads UI
- SPA entry & routes → Auth & app state: provides state
- SPA entry & routes → Role-gated views: renders protected routes
- Role-gated views → Feed & civic views: authorizes
- Role-gated views → Admin dashboard: authorizes
- Feed & civic views → Central API client: API calls
- Admin dashboard → Central API client: API calls
- Central API client → API routes: Bearer /api requests
- API routes → Authentication API: auth endpoints
- API routes → Access gates: authenticates & gates
- Access gates → Post & comment API: authorized civic writes
- Access gates → Poll & payment API: verified poll voting
- Access gates → Administration API: admin operations
- Access gates → NID verification: checks verification
- Authentication API → Users & organizations: accounts & tokens
- Post & comment API → Posts & interactions: manages
- Post & comment API → Users & organizations: authors & ministries
- Poll & payment API → Polls & reward ledger: records responses & points
- Poll & payment API → Users & organizations: poll creators
- Administration API → Posts & interactions: moderates
- Administration API → Users & organizations: approves organizations
- Users & organizations → MySQL / SQLite: persists
- Posts & interactions → MySQL / SQLite: persists
- Polls & reward ledger → MySQL / SQLite: persists
- Posts & interactions → Public media disk: stores images