Rwanda income analyzer
# INJIZA — kwinjiza amafaranga / making income visible
AI-powered bookkeeping over USSD for Rwanda's informal micro-businesses.
---
## Project Structure
```
injiza/
├── backend/ Node.js + Express — Claude AI engine + USSD endpoint
│ ├── src/
│ │ ├── server.js Express app, REST API, USSD callback
│ │ ├── claude.js Anthropic API calls (parseEntry, weeklyInsight)
│ │ ├── ussd.js USSD flow state machine
│ │ └── sessions.js In-memory session store
│ ├── .env Your secrets (copy from .env.example)
│ └── package.json
│
└── frontend/ React 18 + Vite + TypeScript — web dashboard
├── src/
│ ├── main.tsx
│ ├── App.tsx
│ ├── api.ts callClaude() — the single AI engine
│ ├── anim.ts All anime.js helpers
│ ├── types.ts TypeScript interfaces
│ ├── components/
│ │ ├── SmsSkin.tsx SMS/USSD phone mockup UI
│ │ └── AppSkin.tsx Smartphone dashboard UI
│ └── styles/global.css
├── .env
└── package.json
```
---
## Run Steps
### 1. Backend
```bash
cd backend
npm install
# Edit .env — add your Africa's Talking credentials
npm run dev
# → Running on
localhost
# → USSD callback:
localhost
```
### 2. Frontend
```bash
cd frontend
npm install
npm run dev
# →
localhost
```
---
## Africa's Talking USSD Setup
1. Log in to Africa's Talking dashboard
2. Go to **USSD → Create Channel**
3. Set the **Callback URL** to:
- **Local dev (ngrok):** `https:// .
ngrok.io`
- **Production:** `
your-domain.com`
4. To expose your local backend with ngrok:
```bash
npx ngrok http 3001
# Copy the https URL → paste into AT dashboard as callback
```
5. Add your `AT_API_KEY`, `AT_USERNAME`, and `AT_SHORTCODE` to `backend/.env`
### USSD Flow
```
Dial shortcode
→ Main menu (1. Record entry / 2. Today's profit / 3. Weekly insight / 4. Exit)
→ Option 1: type entry in Kinyarwanda/English → AI parses → shows profit + insight
→ Option 2: shows total profit + …