Digital Kilimo Hub β Tanzania agricultural digital ecosystem (Node 20 + Express + PostgreSQL)
# πΎ Digital Kilimo Hub
Tanzania agricultural digital ecosystem β Node.js 20 + Express + PostgreSQL API,
serving a farmer-facing web app from the same service.
## What's here
```
kilimo-hub-node/
βββ src/
β βββ server.js β entry point (npm start)
β βββ db/
β β βββ schema.sql β full schema, auto-applied on every boot
β β βββ pool.js β Postgres connection pool
β βββ middleware/auth.js β JWT verification + role guards
β βββ utils/ β phone/password validation, user serialization
β βββ routes/
β βββ auth.js β register / login / me / logout
β βββ users.js β profile, password change, admin user management
β βββ groups.js β Social Collective Buying
β βββ logistics.js β Dynamic Logistics Link (backhaul matching)
β βββ markets.js β Agri-Intelligence: live crop prices
β βββ loans.js β Credit Scoring Engine
β βββ alerts.js β Agri-Intelligence: pest/weather/market alerts
β βββ admin.js β dashboard stats, user/transaction summaries
βββ public/
βββ index.html β marketing site (CTAs link to the farmer app)
βββ app.html β farmer-facing app (wired to the API above)
βββ admin.html β admin dashboard (wired to the API above)
```
Not yet in this repo: driver- and business-buyer-facing UI (the backend supports
those roles and a `/products` marketplace, but no frontend was uploaded for
them β only the farmer app and admin panel had mockups to wire up), and real
mobile-money integration (see Security notes below).
## Local setup
```bash
npm install
cp .env.example .env # then fill in DATABASE_URL, SECRET_KEY, etc.
npm start
```
Visit `
localhost` to confirm it's running, and
`
localhost` for the farmer app. The schema is created
automatically on boot β there's no separate migration step.
## Deploying on Render
1. Push this repo to GitHub.
2. On Rende β¦