# AI-Pesa Project
AI-Pesa is an AI-powered financial assistant that helps users track and manage their M-Pesa transactions through an intuitive web interface with AI chat capabilities.
## Project Overview
AI-Pesa allows users to:
- Upload M-Pesa statements or paste M-Pesa SMS messages
- Get AI-powered analysis of their transactions
- View categorized spending and financial insights
- Chat with an AI assistant about their finances
- Receive personalized financial advice
## Project Structure
```
/
├── frontend/ # Next.js frontend application
├── backend/ # Express.js backend with Gemini AI integration
├── docs/ # Project documentation
```
## Key Features
### 1. Standardized API Responses
All API responses follow a consistent format:
```json
// Success response
{
"success": true,
"message": "Operation successful message",
"data": { /* Response data */ }
}
// Error response
{
"success": false,
"error": {
"message": "Error message",
"code": "ERROR_CODE"
},
"statusCode": 400
}
```
See API Reference for detailed endpoint documentation.
### 2. Model Consistency
To ensure data consistency between frontend and backend, we use a shared type system:
- TypeScript interfaces in the frontend match MongoDB schemas in the backend
- All models are defined in `frontend/src/types/models.ts`
- Consistent field naming and types across the application
See Model Consistency Guide for more details.
## Frontend
The frontend is a modern, responsive web application built with Next.js that provides:
- User authentication
- Transaction upload interface
- Financial dashboard
- AI chat interface
- Responsive design with dark mode support
See the frontend README for more details.
## Backend
The backend is an Express.js application that:
- Processes M-Pesa transaction data
- Integrates with Google's Gemini AI for analysis
- Stores user data and transactions in MongoDB
- Provides RESTful API endpoints for the frontend
See the backend README for more details.
## Sys …