A Member Center application for Patriot Life Insurance, a fictitious life insurance company serving military personnel and their families. Built with FastAPI, React, and PostgreSQL.
- π Home Page - Information about benefits for non-members
- π Member Dashboard - View membership details, active benefits, and coverage summary
- π Benefit Search & Enrollment - Browse and enroll in available benefits
- π¬ AI Chat Assistant - CrewAI-powered chatbot with personalized member support
- ποΈ PostgreSQL Database - Store member profiles and benefit enrollments
- π³ Docker Compose - Easy deployment with all services
The application includes an AI-powered chat assistant built with CrewAI and AWS Bedrock. The assistant can answer questions about insurance products and provide personalized information for logged-in members.
The chat system uses specialized AI agents powered by AWS Bedrock:
| Agent | Role | Description | Tools |
|---|---|---|---|
| AI Assistant Coordinator | Main orchestrator | Handles all user interactions, answers general questions using the knowledge base, and fetches personalized member data when needed | All tools listed below |
| Member Profile Specialist | Profile queries | Retrieves personal information, military service details (branch, rank, active duty status), and membership information (member number, status, start date) | Get Member Profile |
| Benefits Specialist | Benefits & enrollments | Provides current enrollments, available plans, eligibility requirements, premium costs, beneficiary designations, and coverage summaries by category | Get Current Benefits and Enrollments, Get Available Benefits, Get Benefit Coverage Summary |
| Premium Calculator Specialist | Quotes & cost comparisons | Calculates premium estimates, compares plans side-by-side, and helps estimate coverage needs based on income, dependents, and debts | Calculate Premium, Compare Plans, Estimate Coverage Needs |
| Eligibility Verification Specialist | Eligibility checks | Verifies member eligibility for specific benefits, explains military status implications, and details documentation requirements for enrollment | Check Eligibility, Get Military Status, Verify Documentation Requirements |
| Document Assistant Specialist | Forms & documentation | Helps members navigate forms and paperwork, explains required documents for various actions, and clarifies form fields | Get Required Documents, Generate Form, Explain Form Fields |
| Tool | Description |
|---|---|
| Get Member Profile | Retrieves the logged-in member's personal details, military service information, and membership status |
| Get Current Benefits and Enrollments | Fetches active benefit enrollments with coverage details, premiums, and beneficiary information |
| Get Available Benefits | Lists all available benefit plans with eligibility indicators based on the member's profile |
| Get Benefit Coverage Summary | Provides a high-level summary of the member's total coverage grouped by category |
| Calculate Premium | Calculates monthly premium estimates based on coverage amount, age, and health factors |
| Compare Plans | Compares multiple benefit plans within a category with side-by-side feature and cost comparison |
| Estimate Coverage Needs | Analyzes income, dependents, and debts to recommend appropriate coverage levels |
| Check Eligibility | Verifies if the member qualifies for a specific benefit based on age, military status, and other factors |
| Get Military Status | Retrieves the member's military service status and explains benefit eligibility implications |
| Verify Documentation Requirements | Lists required and optional documents needed to enroll in a specific benefit |
| Get Required Documents | Provides document checklists for various actions (enrollment, claims, beneficiary changes, etc.) |
| Generate Form | Returns information about specific forms including download links and completion tips |
| Explain Form Fields | Provides detailed explanations of form fields to help members complete paperwork correctly |
The assistant integrates with AWS Bedrock Knowledge Base to retrieve relevant information about insurance products from documentation stored in S3. This enables the agent to answer detailed questions about:
- SGLI, VGLI, FSGLI, and S-DVI coverage
- Disability and accident protection plans
- Critical illness and supplemental life insurance
- Eligibility requirements and enrollment procedures
The application includes:
- Public home page with benefit information
- Member login portal
- Dashboard with coverage summary and active enrollments
- Benefit catalog with search and filter capabilities
- Enrollment modal with beneficiary designation
member-center/
βββ backend/
β βββ main.py # FastAPI application with API endpoints
β βββ agents.py # CrewAI agent definitions and tools
β βββ models.py # SQLAlchemy database models
β βββ database.py # Database connection and seeding
β βββ config.py # Configuration settings
β βββ requirements.txt # Python dependencies
β βββ Dockerfile # Backend container
βββ frontend/
β βββ src/
β β βββ pages/
β β β βββ Home.tsx # Public home page
β β β βββ Login.tsx # Member login
β β β βββ Dashboard.tsx # Member dashboard
β β β βββ Benefits.tsx # Benefit search & enrollment
β β βββ components/
β β β βββ Navigation.tsx # Navigation bar
β β β βββ ChatAssistant.tsx # AI chat widget
β β βββ api.ts # API service
β β βββ types.ts # TypeScript types
β β βββ App.tsx # Main app with routing
β β βββ main.tsx
β βββ Dockerfile # Frontend container
β βββ nginx.conf # Nginx configuration
β βββ package.json
βββ data/ # Knowledge base documents
β βββ sgli.md
β βββ vgli.md
β βββ fsgli.md
β βββ ...
βββ docker-compose.yml # Docker Compose with PostgreSQL
βββ README.md
- Docker and Docker Compose (recommended)
- Or for local development:
- Python 3.10+
- Node.js 18+
- PostgreSQL 16+
-
Clone the repository and navigate to it:
git clone <repository-url> cd crew-chat
-
Copy the environment example file and update with your values:
cp .env.example .env
Edit
.envand configure your AWS credentials:AWS_ACCESS_KEY_ID- Your AWS access keyAWS_SECRET_ACCESS_KEY- Your AWS secret keyAWS_REGION- AWS region (default: us-east-1)BEDROCK_MODEL_ID- Bedrock model ID (default: us.anthropic.claude-sonnet-4-20250514-v1:0)BEDROCK_KNOWLEDGE_BASE_ID- Your Bedrock Knowledge Base ID
-
Start all services (PostgreSQL, Backend, Frontend):
docker compose up --build
-
Access the application:
- Frontend: http://localhost:3000
- Backend API: http://localhost:8000
- API Docs: http://localhost:8000/docs
-
Demo credentials:
- Email: john.doe@military.mil
- Password: demo
To stop the application:
docker compose down
# To also remove the database volume:
docker compose down -vStart PostgreSQL:
docker compose up postgres -dOr install PostgreSQL locally and create a database:
CREATE DATABASE membercenter;
CREATE USER membercenter WITH PASSWORD 'membercenter_password';
GRANT ALL PRIVILEGES ON DATABASE membercenter TO membercenter;-
Navigate to the backend directory:
cd backend -
Create a virtual environment:
python -m venv venv source venv/bin/activate # On Windows: venv\Scripts\activate
-
Install dependencies:
pip install -r requirements.txt
-
Set the database URL (if not using Docker):
export DATABASE_URL=postgresql://membercenter:membercenter_password@localhost:5432/membercenter -
Start the server:
python main.py # Or: uvicorn main:app --reload
The API will be available at http://localhost:8000
-
Navigate to the frontend directory:
cd frontend -
Install dependencies:
npm install
-
Start the development server:
npm run dev
The UI will be available at http://localhost:5173
GET /- Health checkGET /health- Health status
POST /api/chat- Send a message to the AI assistant (acceptsmessageand optionaluser_idfor personalized responses)
POST /api/members/login- Member loginGET /api/members/{member_id}- Get member by IDGET /api/members/{member_id}/dashboard- Get member dashboard dataPOST /api/members- Create new member
GET /api/benefits- List all benefits (filter by category)GET /api/benefits/{benefit_id}- Get benefit details
GET /api/members/{member_id}/enrollments- List member enrollmentsPOST /api/members/{member_id}/enrollments- Enroll in benefitDELETE /api/members/{member_id}/enrollments/{enrollment_id}- Cancel enrollment
- Personal information (name, email, address)
- Military service details (branch, rank, active duty status)
- Membership information (member number, status)
- Coverage details (amount, premium, deductible)
- Category (Life Insurance, Disability, Accident, Critical Illness, Supplemental)
- Eligibility requirements (age range, active duty requirement)
- Links members to benefits
- Tracks effective dates and status
- Stores beneficiary information
- Backend: Python, FastAPI, SQLAlchemy, Pydantic
- AI/ML: CrewAI, AWS Bedrock (Claude), AWS Bedrock Knowledge Base
- Frontend: React, TypeScript, React Router, Vite
- Database: PostgreSQL
- Deployment: Docker, Nginx
- SGLI - Service Members' Group Life Insurance ($400,000)
- FSGLI - Family Service Members' Group Life Insurance ($100,000)
- VGLI - Veterans' Group Life Insurance ($250,000)
- S-DVI - Service-Disabled Veterans Insurance ($10,000)
- Military Disability Protection Plus ($5,000/mo)
- Accident Protection Plan ($50,000)
- Critical Illness Shield ($75,000)
- Supplemental Term Life ($500,000)
MIT