# M-Pesa Guardian
M-Pesa Guardian is a fintech solution that receives M-Pesa payments in real time through the Daraja API, analyzes the transactions with an AI-powered fraud detection engine, and displays intelligence dashboards for SME business owners.
## Features
- **Real-time Payment Processing**: Receive and process M-Pesa payments instantly
- **AI-Powered Fraud Detection**: Lightweight machine learning model detects suspicious transactions
- **Risk Scoring**: Automatic risk assessment with low/medium/high/critical levels
- **Intelligence Dashboard**: Beautiful, responsive dashboard with real-time analytics
- **Transaction Monitoring**: Track all payments with detailed information
- **Fraud Alerts**: Get notified of high-risk transactions immediately
- **Customer Analytics**: Understand your customer base and transaction patterns
## Architecture
### Backend (Express.js + PostgreSQL)
- RESTful API with Express.js
- PostgreSQL database for transaction storage
- M-Pesa Daraja API integration
- Lightweight fraud detection engine
- Real-time transaction analysis
### Frontend (Next.js + Tailwind CSS)
- Modern dashboard with Next.js 16
- Responsive design with Tailwind CSS v4
- Real-time data visualization with Recharts
- Component library with shadcn/ui
## Project Structure
\`\`\`
mpesa-guardian/
├── backend/ # Express.js backend
│ ├── src/
│ │ ├── config/ # Database configuration
│ │ ├── routes/ # API routes
│ │ ├── services/ # Business logic
│ │ └── server.js # Entry point
│ ├── package.json
│ └── .env.example
│
├── scripts/ # Database SQL scripts
│ ├── 001_create_tables.sql
│ ├── 002_seed_fraud_patterns.sql
│ └── 003_seed_demo_data.sql
│
├── app/ # Next.js frontend
│ ├── dashboard/ # Dashboard pages
│ ├── login/ # Authentication
│ └── page.tsx # Landing page
│
└── components/ # React components
└── dashboa …