Skip to content

Latest commit

 

History

24 Commits

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 
 
 
 
 
 
 

Repository files navigation

InsureIQ

Post-purchase insurance intelligence for the Indian market.

Most Indians buy insurance and then forget about it — until they need to file a claim and discover their policy doesn't cover what they thought it did. InsureIQ fixes that: upload your policy PDFs, get a coverage score, simulate claim outcomes before they happen, and find products that plug your gaps.


Origin

This project started as a quick Razorpay integration fix for a side project. While debugging payment flows, I kept running into a frustrating pattern: people were paying ₹30,000–₹50,000/year in insurance premiums for policies they didn't understand. The Razorpay fix took 20 minutes. The insurance problem took longer to get out of my head.

InsureIQ is what came out of that itch.


What It Does

Feature Description
Policy Vault Upload PDFs or enter manually. Gemini AI extracts coverage details, exclusions, waiting periods, and sub-limits automatically.
Coverage Score Rules-based engine scores your health, life, vehicle, and home coverage from 0–100 against Indian actuarial benchmarks.
Gap Analysis Identifies critical, major, and minor gaps in your coverage. Streams a personalized AI explanation via SSE.
Claim Simulator Describe a scenario, get a COVERED / PARTIAL / REJECTED verdict with clause-level reasoning — before you file.
Recommendations Matched insurance products from real Indian insurers, filtered by your budget and coverage gaps.
Family Coverage Track policies across family members, not just yourself.

System Design

┌─────────────────────────────────────────────────────────┐
│                    Browser (Next.js 16)                  │
│  Login/Signup → Dashboard → Vault → Gaps → Simulator    │
│  SSE streaming for gap analysis + claim simulation       │
└────────────────────┬────────────────────────────────────┘
                     │ HTTPS + Bearer JWT
┌────────────────────▼────────────────────────────────────┐
│               Go Backend (Chi router)                    │
│                   Railway (iad region)                   │
│                                                          │
│  /auth/*          JWT auth (HS256, 7-day expiry)        │
│  /me/profile      Profile + risk appetite                │
│  /me/family       Family member management               │
│  /me/policies     Policy CRUD + PDF upload               │
│  /me/score        Coverage scoring engine                │
│  /me/score/explain  SSE gap explanation (Gemini)         │
│  /me/policies/:id/simulate  SSE claim sim (Gemini)      │
│  /me/recommendations  Gap-matched product search         │
└──────┬─────────────────────┬───────────────────────────┘
       │                     │
┌──────▼──────┐     ┌────────▼────────┐
│  Supabase   │     │  Google Gemini  │
│  PostgreSQL │     │  2.0 Flash      │
│  + Storage  │     │  PDF extraction │
│  (PDF PDFs) │     │  + SSE streams  │
└─────────────┘     └─────────────────┘

Auth Flow

  • Email/password: bcrypt (cost 12) + constant-time login to prevent email enumeration
  • Google OAuth: GSI One Tap → ID token → backend verifies via Google tokeninfo API → issues JWT

Coverage Scoring Engine

Pure functions, no ML. Benchmarks tuned for Indian market:

  • Health: Coverage ratio vs city-tier benchmark (10L metro / 7L tier-2 / 5L tier-3) + CI rider bonus + waiting period score
  • Life: Coverage vs 10x annual income benchmark + term vs endowment multiplier
  • Vehicle: Comprehensive vs third-party detection + add-on count
  • Home: Binary (covered / not covered)

Streaming

Gap analysis and claim simulation use Server-Sent Events (SSE). The Go backend streams Gemini's response token-by-token. The frontend consumes it via an async generator — no WebSockets, no polling.


Tech Stack

Backend

  • Go 1.25 + Chi v5
  • pgx/v5 (PostgreSQL driver + connection pooling)
  • golang-jwt/jwt v5
  • google/generative-ai-go (Gemini 2.0 Flash)
  • Deployed on Railway

Frontend

  • Next.js 16 (App Router, TypeScript)
  • Tailwind CSS v4 (CSS-first, no config file)
  • js-cookie for JWT storage
  • Google GSI for OAuth
  • Deployed on Vercel

Infrastructure

  • Supabase: PostgreSQL + object storage (policy PDFs)
  • Google Gemini Flash: PDF extraction + streamed AI analysis
  • Railway: Go backend container (Dockerfile, 256MB)
  • Vercel: Next.js frontend (edge CDN)

Database Schema

users
  └── profiles (1:1)
        ├── family_members (1:N)
        └── policies (1:N)
              ├── policy_coverage (1:1)
              └── policy_members (N:M → family_members)

coverage_scores  (latest score per profile)
insurance_products  (seeded: 15 real Indian products)

Local Development

Prerequisites: Go 1.25+, Node.js 20+, PostgreSQL (or Supabase account)

git clone git@github.com:BREACH1247/InsureIQ.git
cd InsureIQ

Backend

cd backend
cp .env.example .env   # fill in your keys
go run .

Frontend

cd web
cp .env.example .env.local   # set NEXT_PUBLIC_API_URL=http://localhost:8080
npm install
npm run dev

Database

psql $DATABASE_URL -f db/migrations/001_initial.sql
psql $DATABASE_URL -f db/seeds/products.sql

Environment Variables

Backend (.env)

PORT=8080
DATABASE_URL=postgresql://...
SUPABASE_URL=https://xxx.supabase.co
SUPABASE_SERVICE_KEY=...
GEMINI_API_KEY=...
JWT_SECRET=...
FRONTEND_URL=http://localhost:3000
GOOGLE_CLIENT_ID=...

Frontend (.env.local)

NEXT_PUBLIC_API_URL=http://localhost:8080
NEXT_PUBLIC_GOOGLE_CLIENT_ID=...

Deployment

Backend → Railway

  1. Connect GitHub repo, set root directory to backend
  2. Railway auto-detects Dockerfile
  3. Set all backend env vars in the Variables tab

Frontend → Vercel

cd web && vercel --prod

Set NEXT_PUBLIC_API_URL and NEXT_PUBLIC_GOOGLE_CLIENT_ID in Vercel project settings.


Project Structure

InsureIQ/
├── backend/
│   ├── internal/
│   │   ├── auth/          # JWT + bcrypt
│   │   ├── config/        # Env loading
│   │   ├── gemini/        # Gemini client + PDF extraction
│   │   ├── handlers/      # HTTP handlers (auth, profile, policy, scoring, SSE)
│   │   ├── scoring/       # Rules-based coverage engine
│   │   ├── sse/           # SSE writer helper
│   │   └── storage/       # Supabase storage client
│   ├── Dockerfile
│   └── main.go
├── web/
│   ├── app/               # Next.js App Router pages
│   ├── components/        # Shared UI components
│   └── lib/               # API client + types
└── db/
    ├── migrations/
    └── seeds/

What's Next

  • Push notifications for policy renewals (60-day warning)
  • OCR fallback for scanned/image PDFs
  • Premium payment tracking
  • Multi-language support (Hindi, Tamil, Telugu)
  • IRDAI product database integration for live pricing

About

No description, website, or topics provided.

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages