System Architecture

How InsureAI is Built

A full-stack AI insurance demo exploring what a modern, zero-agent carrier could look like. Claude handles every claim decision end-to-end — no human adjusters, no underwriters, no database.

InsureAI system architecture diagram

Tech Stack

Frontend

Next.js 16App Router, server + client components
TypeScriptEnd-to-end type safety
Tailwind CSS v4CSS-first config, design tokens via @theme
shadcn/ui + base-uiAccessible component primitives (Slider, Select, Sheet)
localStorageUser-submitted claims cached per-browser — no shared state between visitors

Backend API

FastAPIAsync Python REST API with OpenAPI docs at /docs
Pydantic v2Request validation with field-level validators (50–500 char description cap)
In-memory storePreset policies and example claims hardcoded in store.py — zero database dependency
No persistenceUser claims processed and returned immediately, never stored server-side

AI Layer

Claude Sonnet 4.6Anthropic's model powering every claim decision
Structured JSON outputDeterministic decision, fraud_score, fraud_flags, reasoning, payout
Rich claim contextPolicy age, coverage limit, deductible, claim type, incident date, loss amount all fed to Claude
ClaimAI system promptRole-scoped prompt with explicit fraud scoring logic and decision thresholds

Data & Privacy

demo-auto-policySingle hardcoded auto policy (Toyota Camry) — no user accounts
3 preset claimsOne approved, one escalated, one denied — always visible as examples
Browser-only user claimsSubmitted claims stored in localStorage, isolated per visitor
No PII collectedNo sign-up, no email, no tracking — public demo safe by design

Claim Processing Flow

What happens from page load to AI decision.

01

Demo Page Loads

Browser fetches the hardcoded demo policy (demo-auto-policy) from GET /api/policies/demo-auto-policy. Preset example claims load from GET /api/claims/demo-auto-claims.

02

User Adjusts Policy Variables

Coverage limit, policy age, and deductible sliders let the user dial in scenario conditions. These are sent with the claim — not saved anywhere.

03

Claim Submitted

Claim type, incident date, estimated loss, and description POST to /api/claims. Pydantic validates the payload — description must be 50–500 characters.

04

Claude Analyzes the Claim

ai_service.py builds a structured prompt with all policy and claim context, then calls Claude Sonnet 4.6. Claude returns a strict JSON object with decision, fraud_score, fraud_flags, reasoning, and payout.

05

Result Returned & Cached

The API returns the result immediately — nothing is stored server-side. The frontend saves the claim to localStorage, then navigates to /claims/[id] to render the decision.

06

Result Rendered

The claim result page reads the preset claims from the API, or falls back to localStorage for user-submitted claims. Fraud score bar, AI reasoning, flags, and payout are all displayed.

Key Design Decisions

No database

Removing the DB eliminated SQLAlchemy, migrations, connection pooling, and seeding logic. The demo runs with a single Python file (store.py) as the data layer. Trivially deployable anywhere.

Structured AI output

Claude is instructed to return only valid JSON. A strict schema (decision, fraud_score, flags, reasoning, payout) makes the output deterministic and directly usable — no parsing, no post-processing.

localStorage for user claims

User-submitted claims are cached in the browser, not on the server. 100 visitors each see only their own claims. No shared state, no leakage, no privacy concerns — and no backend storage cost.