# M-Pesa Business Manager
An all-in-one dashboard for Kenyan SMEs — run sales, M-Pesa transactions,
expenses, inventory and customers from a single place.
Built with **Next.js 16 (App Router)**, **Prisma 7** (query-compiler client +
`pg` driver adapter), **PostgreSQL**, **Tailwind CSS v4**, **Radix UI**,
**Recharts** and **Supabase Auth** (optional).
---
## Features
- **Point of sale** — ring up sales with M-Pesa STK push, cash, card, bank or credit.
- **M-Pesa** — incoming/outgoing transaction ledger with simulated Daraja STK push in demo mode.
- **Inventory** — cost/selling prices, margins, stock levels and low-stock alerts.
- **Customers** — contact book with loyalty points and purchase history.
- **Expenses** — categorised cost tracking (rent, salaries, stock, utilities…).
- **Reports** — profit & loss, cash flow, top products and top customers.
- **Dashboard** — live KPIs, revenue chart, payment-method breakdown and activity feeds.
- **Demo mode** — zero-config sign-in and a seeded Nairobi grocery ("Kijani Fresh Foods").
---
## Quick start
### 1. Install dependencies
```bash
npm install
```
### 2. Start a database
**Option A — Docker (recommended):**
```bash
docker compose up -d
```
**Option B — Prisma Postgres dev server (no Docker, WASM-based):**
```bash
npx prisma dev --db-port 5433
```
### 3. Configure environment
```bash
cp .env.example .env
```
The default `DATABASE_URL` targets the local database from either option above.
### 4. Create the schema & seed demo data
```bash
npm run db:setup
```
This runs `prisma db push` followed by the seed script, creating the
"Kijani Fresh Foods" demo business with ~90 days of realistic sales, M-Pesa
transactions, expenses, products and customers.
> **No Prisma engine download available?** If the sandbox/CI can't reach
> `binaries.prisma.sh`, bootstrap the schema manually instead:
>
> ```bash
> node scripts/init-db.mjs # applies prisma/init.sql (mirrors schema.prisma)
> npx tsx prisma/seed.ts # …