# InsureAI Naija - Proof of Concept
InsureAI Naija is a WhatsApp-first AI-powered insurance platform designed for the Nigerian market. This Proof of Concept (PoC) demonstrates the ability to onboard users, sell policies, and process claims using an automated conversational flow (simulated WhatsApp) and an Admin Dashboard.
## 🚀 Getting Started
1. **Install Dependencies**:
```bash
npm install
```
2. **Start PostgreSQL Database**:
We use Docker to run a local Postgres instance.
```bash
docker-compose up -d
```
3. **Initialize Database**:
```bash
# Generates Prisma Client and creates tables in Postgres
npx prisma generate
npx prisma db push
```
4. **Run Development Server**:
```bash
npm run dev
```
5. **Open in Browser**:
- **Simulator (Chat Bot)**:
localhost
- **Admin Dashboard**:
localhost
## ☁️ Production / WhatsApp Integration
To use the **Real WhatsApp API**:
1. Obtain credentials from the Meta Developer Portal.
2. Update `.env` with:
- `WHATSAPP_ACCESS_TOKEN`
- `WHATSAPP_PHONE_NUMBER_ID`
- `WHATSAPP_VERIFY_TOKEN`
3. Expose your local server using **ngrok**:
```bash
ngrok http 3000
```
4. Configure the Webhook URL in Meta Portal: `https:// /api/webhook/whatsapp`
## 📂 Project Structure
The project follows a strict Client-Server separation within the `src` directory to maintain modularity and clear concerns.
### `src/server` (Backend Logic)
Contains all business logic, database interactions, and AI services. Code here runs strictly on the server.
- **`database/`**: Prisma Client configuration (`prisma.ts`).
- **`services/`**: Core business services (User, Policy, Claim) that interact with the DB.
- **`ai/`**: Mock AI services for NLU (intent detection) and Scoring (fraud/risk).
- **`fsm/`**: The **Finite State Machine** engine that drives the conversational logic.
### `src/client` (Frontend Components)
Contains reusable UI components and client-side assets.
- **`components/`**: React components use …