Logo Lanfrica

madassdev/oneacre-farmer-reg

Domaine:

agriculture

Type de record:

software
Créateur:
mad
Hôte:
Offline-first farmer registration prototype for One Acre Fund Nigeria field officers. Field officers can register farmers without internet, track sync status, and sync records when connectivity returns. An admin portal shows successfully synced farmers. # One Acre Fund — Farmer Registration Prototype Offline-first farmer registration prototype for One Acre Fund Nigeria field officers. Field officers can register farmers without internet, track sync status, and sync records when connectivity returns. An admin portal shows successfully synced farmers. ## Technology stack - **Next.js 16** (App Router) — full-stack application - **React 19** — field officer and admin UI - **SQLite** (`better-sqlite3`) — server-side store for synced farmers - **Dexie.js** — IndexedDB storage for offline records - **Zod** — shared validation for form input and API payloads - **Tailwind CSS** — styling - **Lucide React** — icons - **Plus Jakarta Sans** — typography ## How to run ```bash npm install npm run dev ``` Open: - Field Officer app: localhost - Queue (mobile): localhost - Admin portal: localhost - Settings: localhost - Architecture explorer: localhost The SQLite database file is created automatically at `data/farmers.db` on first API use. ## How to test offline and sync behaviour ### Option 1: In-app offline simulation 1. Open the field officer app at `/`. 2. Click **Simulate offline**. 3. Register one or more farmers — they should appear with status **pending**. 4. Click **Disable offline simulation** (or use **Sync pending farmers** while online). 5. Pending records should change to **synced**. 6. Open `/admin` and confirm the farmers appear in the table. ### Option 2: Browser DevTools 1. Open DevTools → **Network** → set throttling to **Offline**. 2. Register farmers and confirm they stay **pending**. 3. Set network back to **Online** — records should sync automatically. 4. Refresh `/admin` to verify synced records. ### Additional checks | Scenario | Expected result | |----------|-----------------| | Submit with empty required fields | Form validation blocks save | | Register same phone twice locally | Warning show …