An eligibility checker for Malaysian public aid programmes, with plain-language explanations in BM and English.
Built with Next.js, TypeScript, Drizzle ORM / PGlite, and OpenDOSM open data.
Important
This is not an official government service. It is an independent, open-source project. Every eligibility result and ringgit figure is an estimate produced by this application's own rules ā never an official determination. Always confirm with the relevant agency before applying.
A user enters their state, household income, household size, employment status, and any special indicators (OKU, warga emas, single parent, youth). The app then:
- Filters a catalogue of aid programmes against those inputs.
- Returns the programmes the user appears to qualify for, with an estimated annual value.
- Explains each match in Malay and English, and lists the documents needed.
- Shows the user's income relative to their state's median household income, using DOSM data.
- Lets the user mark programmes they already receive, to surface unclaimed support.
- Copies an action plan to the clipboard for offline use.
Being precise about this matters more than sounding impressive.
| Element | Status |
|---|---|
| State household income, low-income CPI | Live from api.data.gov.my (OpenDOSM), cached 5 minutes, with a bundled DOSM 2024 fallback |
| State poverty rates | Bundled DOSM 2024 figures ā not fetched live |
| Aid programme catalogue | Curated by hand in src/db/seed-data.ts; editable via the admin API |
| Eligibility matching | Deterministic rules in src/lib/aid-engine.ts |
| Explanations (BM/EN) | Templated strings chosen by programme code ā no language model is called |
| Estimated annual values | Heuristic (base amount plus a household-size adjustment), clearly labelled EST. |
| Payout calendar dates | Indicative only ā not sourced from any API; the UI says so |
| Notification delivery | Not implemented. Contact registration records interest only |
The banner on screen and the status field in /api/pasarapi/snapshot reflect the real state of the live feed (online / partial / fallback). If OpenDOSM is unreachable, the app says so instead of claiming to be live.
Eligibility outcomes here need to be explainable and reproducible. A deterministic engine means:
- The same input always produces the same output.
- Every match can be traced to a specific rule and reason string.
- No personal financial data leaves the server to a third-party model provider.
The trade-off is that the catalogue and rules need manual upkeep as schemes change. That is deliberate.
- Notification alerts are not delivered.
/api/alertsstores a keyed hash and a masked contact; nothing sends email or SMS yet. The UI says this explicitly. - Serverless storage is ephemeral. On Vercel, PGlite runs in memory, so scan history and alert registrations do not survive a cold start. Point
DATABASE_URLat a networked Postgres for durable storage. - Programme data ages. Thresholds and payout dates are hardcoded and must be reviewed each budget cycle.
- No automated tests yet. The eligibility engine is the highest-value place to add them.
v1/is a legacy prototype, excluded from typecheck and lint.
Requires Node.js 20+.
npm install npm run dev
Open http://localhost:3000.
npm run build # production build npm run start # serve the build npm run lint npm run typecheck
| Variable | Required | Purpose |
|---|---|---|
ADMIN_API_KEY |
For admin use | Unlocks /api/admin/*. If unset in production, those routes return 404. |
ALERT_HASH_SECRET |
Recommended | Key for the HMAC used to hash alert contacts. A dev-only fallback is used if unset. |
DATABASE_URL |
For drizzle-kit only |
Runtime uses PGlite; this is for migration tooling. |
The admin dashboard is at /admin; paste the key there to unlock it. The key is kept in sessionStorage only.
src/
āāā app/ # Next.js App Router (page, admin, API routes)
āāā lib/
ā āāā aid-engine.ts # deterministic eligibility rules
ā āāā pasarapi.ts # OpenDOSM client + provenance tracking
ā āāā admin-auth.ts # admin key gate
āāā db/ # Drizzle schema, PGlite bootstrap, seed catalogue
Created for a community challenge encouraging Malaysian developers to build practical, AI-assisted applications using real-world open data.
- š KRACKED DEVS Bounty: https://krackeddevs.com/code/bounty/pasarapi-bounty
- š PasarAPI: https://pasarapi.xyz/
Thanks to both teams for running the initiative.
MIT ā see LICENSE.
https://bantu-rakyat-ai.vercel.app
Made with ā¤ļø using Next.js + TypeScript