Feb 22, 2026

Polaris AI - Intelligent Compliance Automation & Risk Management

gemini complianceagent datapolicyagent ai agent gcp bigquery polarisai algorhythm

Next-Generation Compliance Platform Powered by Generative AI

Transform policy documents into automated enforcement rules using advanced AI


πŸ“‹ Overview

A next-generation compliance platform that transforms policy documents into automated enforcement rules using advanced AI. Polaris AI eliminates manual compliance monitoring by intelligently scanning millions of transactions across financial, fraud, and HR datasets, detecting violations with 95%+ accuracy, and providing actionable risk insights.

The platform features natural language policy interpretation, real-time violation detection, entity-level risk scoring, and comprehensive performance metricsβ€”empowering organizations to maintain regulatory compliance at scale while reducing operational overhead.

Core Capabilities

  • πŸ“„ AI-Powered Policy Extraction - Automatically converts policy documents into executable compliance rules using Google Document AI
  • πŸ€– Intelligent Rule Generation - Leverages Vertex AI (Gemini 2.5 Flash) for natural language to SQL rule translation
  • πŸ” Real-Time Violation Detection - Scans 6.4M+ records across BigQuery datasets with precision analytics
  • ⚑ Advanced Risk Scoring - Entity-level risk profiling with severity classification and explanation generation
  • πŸ“Š Performance Metrics - Precision, recall, F1 scores, confusion matrix, and compliance rate tracking
  • 🎯 Interactive Dashboards - Real-time visualization with violation tracking and audit reporting

Supports AML (Anti-Money Laundering)Fraud Detection, and HR Compliance domains with enterprise-grade scalability.


✨ Key Features

πŸ” Smart Policy Processing

  • Upload PDF policy documents
  • AI extracts text using Google Document AI
  • Vertex AI Gemini generates executable SQL-based compliance rules
  • Validates rules against BigQuery schema automatically

⚑ Real-Time Compliance Scanning

  • Execute compliance scans across multiple datasets
  • Server-Sent Events (SSE) for live progress tracking
  • BigQuery integration for high-performance data analysis
  • Configurable violation limits for cost optimization

πŸ‘οΈ Intelligent Violation Management

  • Detect policy violations with context-aware AI explanations
  • Severity classification (Critical, High, Medium, Low)
  • Filter by dataset, status, severity
  • Mark violations as resolved with audit trail

πŸ“Š Advanced Analytics

  • Precision, Recall, F1 Score calculations
  • Compliance score tracking
  • Confusion matrix visualization
  • Dataset-specific performance metrics

🎯 Risk Intelligence

  • Entity-level risk scoring
  • Behavioral pattern analysis
  • Network graph visualizations
  • Anomaly detection

πŸ§ͺ Policy Simulator

  • Test compliance rules before deployment
  • Sandbox environment for rule validation
  • Compare different rule configurations
  • Validate SQL condition logic

πŸ—οΈ Architecture

β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
β”‚                     Frontend (React + TypeScript)            β”‚
β”‚  β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”  β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”  β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”  β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”   β”‚
β”‚  β”‚Dashboard β”‚  β”‚Violationsβ”‚  β”‚ Metrics  β”‚  β”‚Simulator β”‚   β”‚
β”‚  β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜  β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜  β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜  β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜   β”‚
β”‚         β”‚              β”‚              β”‚              β”‚       β”‚
β”‚         β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”΄β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”΄β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜       β”‚
β”‚                         β”‚                                    β”‚
β”‚                    Axios API Client                          β”‚
β”‚                         β”‚                                    β”‚
β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”Όβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜
                          β”‚ REST API + SSE
β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”Όβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
β”‚                    Backend (FastAPI)                         β”‚
β”‚  β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”΄β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”          β”‚
β”‚  β”‚              Route Handlers                     β”‚          β”‚
β”‚  β”‚  /scan  /violations  /metrics  /simulator      β”‚          β”‚
β”‚  β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”˜          β”‚
β”‚               β”‚             β”‚             β”‚                  β”‚
β”‚  β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β–Όβ”€β”€β”€β”€β”€β” β”Œβ”€β”€β”€β”€β”€β–Όβ”€β”€β”€β”€β”€β”€β” β”Œβ”€β”€β”€β–Όβ”€β”€β”€β”€β”€β”€β”€β”€β”        β”‚
β”‚  β”‚  Rule Engine     β”‚ β”‚ Validation β”‚ β”‚ Risk Engineβ”‚        β”‚
β”‚  β”‚  (SQL Generation)β”‚ β”‚   Engine   β”‚ β”‚            β”‚        β”‚
β”‚  β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”˜ β””β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”˜ β””β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”€β”˜        β”‚
β”‚               β”‚             β”‚             β”‚                  β”‚
β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”Όβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”Όβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”Όβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜
                β”‚             β”‚             β”‚
β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”Όβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”Όβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”Όβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
β”‚                    Google Cloud Platform                     β”‚
β”‚  β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β–Όβ”€β”€β”  β”Œβ”€β”€β”€β”€β”€β”€β–Όβ”€β”€β”€β”€β”€β”€β”  β”Œβ”€β”€β–Όβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”       β”‚
β”‚  β”‚   BigQuery     β”‚  β”‚ Document AI β”‚  β”‚ Vertex AI  β”‚       β”‚
β”‚  β”‚  (Data Storage)β”‚  β”‚(PDF Extract)β”‚  β”‚  (Gemini)  β”‚       β”‚
β”‚  β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜  β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜  β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜       β”‚
β”‚                                                              β”‚
β”‚  β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”       β”‚
β”‚  β”‚          Cloud Storage (Policy PDFs)            β”‚       β”‚
β”‚  β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜       β”‚
β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜
 

πŸš€ Quick Start (5 Minutes)

1️⃣ Prerequisites

Check you have everything installed:

# Python 3.9+ (recommended: 3.13)
python3 --version

# Node.js 18+ (or Bun)
node --version

# GCP CLI (optional, for setup)
gcloud --version
 

2️⃣ Clone & Setup

# Clone repository
git clone <your-repo-url>
cd polaris-ai-compliance

# Setup backend
cd backend
python3 -m venv venv
source venv/bin/activate  # On Windows: venv\Scripts\activate
pip install -r requirements.txt

# Setup frontend
cd ../frontend
npm install  # or: bun install
 

3️⃣ Configure GCP Credentials

  1. Create GCP Service Account with these roles:

    • BigQuery Admin
    • Document AI User
    • Vertex AI User
    • Storage Admin
  2. Download JSON key and save as:

    backend/gcp/service-account.json
    
     

    ⚠️ Security Note: This file is gitignored - never commit credentials!

  3. Configure environment in backend/.env:

    # GCP Configuration
    GCP_PROJECT_ID=your-project-id
    GCP_LOCATION=us  # Document AI region
    GCP_BUCKET_NAME=your-bucket-name
    
    # Vertex AI Configuration
    VERTEX_AI_LOCATION=us-central1
    VERTEX_AI_MODEL=gemini-2.0-flash-exp
    
    # Document AI
    DOCUMENT_AI_PROCESSOR_ID=your-processor-id
    
    # BigQuery Datasets
    BIGQUERY_DATASET_AML=aml_dataset
    BIGQUERY_DATASET_FRAUD=fraud_dataset
    BIGQUERY_DATASET_HR=hr_dataset
     

4️⃣ Start Application

Terminal 1 - Backend:

cd backend
source venv/bin/activate
python -m uvicorn main:app --reload --port 8000
 

Terminal 2 - Frontend:

cd frontend
npm run dev  # or: bun run dev
 

5️⃣ Open Browser


πŸ“– Detailed Documentation


πŸ—‚οΈ Project Structure

polaris-ai-compliance/
β”œβ”€β”€ backend/
β”‚   β”œβ”€β”€ main.py                    # FastAPI application entry
β”‚   β”œβ”€β”€ config.py                  # Configuration management
β”‚   β”œβ”€β”€ logger.py                  # Centralized logging
β”‚   β”œβ”€β”€ requirements.txt           # Python dependencies
β”‚   β”œβ”€β”€ .env                       # Environment variables (not in git)
β”‚   β”‚
β”‚   β”œβ”€β”€ gcp/
β”‚   β”‚   └── service-account.json   # GCP credentials (gitignored)
β”‚   β”‚
β”‚   β”œβ”€β”€ models/
β”‚   β”‚   β”œβ”€β”€ __init__.py
β”‚   β”‚   └── rule_model.py          # Pydantic data models
β”‚   β”‚
β”‚   β”œβ”€β”€ routes/
β”‚   β”‚   β”œβ”€β”€ __init__.py
β”‚   β”‚   β”œβ”€β”€ scan_routes.py         # Compliance scan endpoints
β”‚   β”‚   β”œβ”€β”€ violations_routes.py   # Violation management
β”‚   β”‚   β”œβ”€β”€ metrics_routes.py      # Analytics endpoints
β”‚   β”‚   β”œβ”€β”€ policy_routes.py       # Policy upload/management
β”‚   β”‚   └── simulator_routes.py    # Policy testing
β”‚   β”‚
β”‚   └── services/
β”‚       β”œβ”€β”€ __init__.py
β”‚       β”œβ”€β”€ bigquery_service.py    # BigQuery integration
β”‚       β”œβ”€β”€ document_ai_service.py # Document AI integration
β”‚       β”œβ”€β”€ vertex_ai_service.py   # Vertex AI/Gemini integration
β”‚       β”œβ”€β”€ gcs_service.py         # Cloud Storage operations
β”‚       β”œβ”€β”€ rule_engine.py         # Rule execution logic
β”‚       β”œβ”€β”€ validation_engine.py   # Metrics calculation
β”‚       └── risk_engine.py         # Risk scoring engine
β”‚
β”œβ”€β”€ frontend/
β”‚   β”œβ”€β”€ src/
β”‚   β”‚   β”œβ”€β”€ components/
β”‚   β”‚   β”‚   β”œβ”€β”€ ui/                # shadcn/ui components
β”‚   β”‚   β”‚   β”œβ”€β”€ StatCard.tsx       # Metric display cards
β”‚   β”‚   β”‚   β”œβ”€β”€ Navbar.tsx         # Navigation bar
β”‚   β”‚   β”‚   └── AppSidebar.tsx     # Sidebar navigation
β”‚   β”‚   β”‚
β”‚   β”‚   β”œβ”€β”€ pages/
β”‚   β”‚   β”‚   β”œβ”€β”€ Index.tsx          # Dashboard homepage
β”‚   β”‚   β”‚   β”œβ”€β”€ UploadPolicy.tsx   # Policy upload interface
β”‚   β”‚   β”‚   β”œβ”€β”€ RunScan.tsx        # Scan execution page
β”‚   β”‚   β”‚   β”œβ”€β”€ Violations.tsx     # Violation management
β”‚   β”‚   β”‚   β”œβ”€β”€ Metrics.tsx        # Analytics dashboard
β”‚   β”‚   β”‚   β”œβ”€β”€ RiskInsights.tsx   # Risk analysis
β”‚   β”‚   β”‚   β”œβ”€β”€ PolicySimulator.tsx# Rule testing
β”‚   β”‚   β”‚   └── AuditReports.tsx   # Report generation
β”‚   β”‚   β”‚
β”‚   β”‚   β”œβ”€β”€ layouts/
β”‚   β”‚   β”‚   └── DashboardLayout.tsx# Main app layout
β”‚   β”‚   β”‚
β”‚   β”‚   β”œβ”€β”€ lib/
β”‚   β”‚   β”‚   β”œβ”€β”€ api.ts             # Axios API client
β”‚   β”‚   β”‚   β”œβ”€β”€ utils.ts           # Helper functions
β”‚   β”‚   β”‚   └── mockData.ts        # Development data
β”‚   β”‚   β”‚
β”‚   β”‚   β”œβ”€β”€ hooks/
β”‚   β”‚   β”‚   β”œβ”€β”€ use-toast.ts       # Toast notifications
β”‚   β”‚   β”‚   └── use-mobile.tsx     # Mobile detection
β”‚   β”‚   β”‚
β”‚   β”‚   β”œβ”€β”€ App.tsx                # Root component
β”‚   β”‚   └── main.tsx               # Entry point
β”‚   β”‚
β”‚   β”œβ”€β”€ package.json
β”‚   β”œβ”€β”€ vite.config.ts
β”‚   β”œβ”€β”€ tailwind.config.ts
β”‚   └── tsconfig.json
β”‚
β”œβ”€β”€ .gitignore                     # Git exclusions (includes GCP credentials)
β”œβ”€β”€ README.md                      # This file
β”œβ”€β”€ QUICK_START.md                 # Quick setup guide
β”œβ”€β”€ SETUP_GUIDE.md                 # Detailed setup
└── TESTING_GUIDE.md               # Testing instructions
 

πŸ› οΈ Tech Stack

Frontend

Technology Purpose
React 18 UI framework
TypeScript Type safety
Vite Build tool & dev server
TanStack Query Server state management
Tailwind CSS Utility-first styling
shadcn/ui Component library
Framer Motion Animations
React Router Client-side routing
Recharts Data visualization
Axios HTTP client

Backend

Technology Purpose
FastAPI Web framework
Python 3.13 Language runtime
Uvicorn ASGI server
Pydantic Data validation
AsyncIO Async processing

Google Cloud Platform

Service Purpose
BigQuery Data warehouse & SQL execution
Document AI PDF text extraction
Vertex AI (Gemini) Rule generation & explanations
Cloud Storage Policy document storage

πŸ“š Available Commands

Backend

# Development
python -m uvicorn main:app --reload --port 8000

# Production
python -m uvicorn main:app --host 0.0.0.0 --port 8000

# With specific config
python -m uvicorn main:app --reload --port 8000 --log-level debug

# Run tests (if available)
pytest

# Clear cache
find . -type d -name __pycache__ -exec rm -rf {} +
 

Frontend

# Development server
npm run dev          # Starts on http://localhost:5173

# Build for production
npm run build        # Output to dist/

# Preview production build
npm run preview

# Run tests
npm run test

# Lint code
npm run lint
 

πŸ”§ Configuration

Backend Environment Variables

Create backend/.env with the following:

# Application
APP_NAME=Polaris AI Compliance API
APP_VERSION=1.0.0
DEBUG=True
HOST=0.0.0.0
PORT=8000

# CORS
CORS_ORIGINS=["http://localhost:5173","http://localhost:8000"]

# GCP Project
GCP_PROJECT_ID=your-project-id
GCP_LOCATION=us
GCP_BUCKET_NAME=your-compliance-bucket

# Vertex AI (Gemini)
VERTEX_AI_LOCATION=us-central1
VERTEX_AI_MODEL=gemini-2.0-flash-exp

# Document AI
DOCUMENT_AI_PROCESSOR_ID=your-processor-id

# BigQuery
BIGQUERY_DATASET_AML=aml_dataset
BIGQUERY_DATASET_FRAUD=fraud_dataset
BIGQUERY_DATASET_HR=hr_dataset

# Performance
VIOLATION_LIMIT=10  # Violations per rule
 

Frontend Configuration

The frontend automatically connects to http://localhost:8000 for API calls. To change this, modify frontend/src/lib/api.ts:

const api = axios.create({
  baseURL: 'http://localhost:8000',
  timeout: 30000,
});
 

πŸ“– API Endpoints

Core Endpoints

GET  /                           API health check
GET  /health                     Health status

POST /api/policy/upload          Upload policy PDF
GET  /api/policy/rules           List all rules

POST /api/scan/run               Execute compliance scan
GET  /api/scan/stream/progress   SSE progress updates

GET  /api/violations/list        Get violations with filters
GET  /api/violations/{id}        Get violation details
POST /api/violations/{id}/explain Generate AI explanation
PUT  /api/violations/{id}/resolve Mark violation as resolved

GET  /api/metrics/dashboard      Dashboard metrics
GET  /api/metrics/dataset/{type} Dataset-specific metrics

POST /api/simulator/simulate     Test compliance rule
POST /api/simulator/compare      Compare rule configurations
POST /api/simulator/validate     Validate SQL condition
 

Full API Documentationhttp://localhost:8000/docs (Swagger UI)


🎯 Usage Flow

1. Upload Policy Document

# Via UI: Navigate to /upload-policy
# Or via API:
curl -X POST http://localhost:8000/api/policy/upload \
  -F "file=@policy.pdf"
 

What happens:

  1. File uploads to Cloud Storage
  2. Document AI extracts text
  3. Vertex AI Gemini generates rules
  4. Rules validated against BigQuery schema
  5. Rules stored in memory for scanning

2. Run Compliance Scan

# Via UI: Navigate to /scan, select dataset
# Or via API:
curl -X POST http://localhost:8000/api/scan/run \
  -H "Content-Type: application/json" \
  -d '{"dataset": "hr"}'
 

What happens:

  1. Fetches rules for selected domain
  2. Generates SQL queries from rules
  3. Executes queries on BigQuery
  4. Detects violations (limit: 10 per rule)
  5. Calculates compliance metrics
  6. Streams real-time progress via SSE

3. Review Violations

Navigate to /violations to:

  • Filter by dataset, severity, status
  • Search by record identifier or rule ID
  • Generate AI explanations for violations
  • Resolve violations with audit trail
  • Export violation data

4. Analyze Metrics

Navigate to /metrics to view:

  • Precision, Recall, F1 Score
  • Compliance score (percentage)
  • Confusion matrix
  • Dataset comparisons
  • Historical trends

πŸ§ͺ Testing

Quick Test Flow

  1. Start both servers (backend + frontend)
  2. Upload test policy: Use Employee_Performance_Compliance_Policy.pdf or any PDF
  3. Wait for processing: Should show "8 rules validated" (or similar)
  4. Run scan: Select "HR" dataset, click "Run Compliance Scan"
  5. Watch progress: Real-time SSE updates (4 steps)
  6. View violations: Navigate to Violations page
  7. Generate explanation: Click "Generate Explanation" on any violation
  8. Check metrics: Navigate to Metrics page

Verify Success

βœ… Policy upload shows 100% progress
βœ… Rules validated with 0 errors
βœ… Scan completes without 500 errors
βœ… Violations display correctly
βœ… Metrics show calculated values
βœ… No CORS errors in browser console
βœ… SSE connection shows in Network tab

For comprehensive testing instructions, see TESTING_GUIDE.md


πŸ› Troubleshooting

Backend Issues

Port already in use:

lsof -i :8000
kill -9 <PID>
 

Module import errors:

source venv/bin/activate
pip install -r requirements.txt
 

GCP authentication errors:

# Verify credentials exist
ls backend/gcp/service-account.json

# Check environment variable (optional)
export GOOGLE_APPLICATION_CREDENTIALS="$PWD/backend/gcp/service-account.json"
 

BigQuery errors:

  • Verify datasets exist: aml_datasetfraud_datasethr_dataset
  • Check service account has BigQuery Admin role
  • Verify table names match configuration

Frontend Issues

Blank page:

  • Check browser console for errors (F12)
  • Verify backend is running on port 8000
  • Check CORS configuration in backend

API errors:

  • Verify backend is accessible: curl http://localhost:8000/health
  • Check Network tab in DevTools for error details
  • Look for 422 validation errors (parameter mismatches)

SSE disconnects:

  • System automatically falls back to polling
  • Check backend logs for errors
  • Verify EventSource supported in browser

Common Issues

Problem Solution
Failed to load resource: 500 Check backend logs, verify GCP credentials
422 Unprocessable Content Check API request parameters match backend model
CORS errors Verify backend CORS_ORIGINS includes frontend URL
Module not found Run pip install -r requirements.txt
Connection refused Ensure backend running on correct port

πŸ”’ Security

Credentials Protection

βœ… GCP credentials are gitignored:

  • service-account.json excluded from git
  • Never commit credentials to repository
  • Use environment-specific credentials

Best Practices

  1. Never commit backend/gcp/service-account.json
  2. Rotate credentials regularly
  3. Use minimal permissions for service accounts
  4. Enable audit logging in GCP
  5. Review access patterns in Cloud Console

Verify Protection

# Check if credentials are ignored
git check-ignore backend/gcp/service-account.json
# Should output: backend/gcp/service-account.json

# Verify not in git history
git ls-files | grep service-account.json
# Should output nothing
 

πŸ“Š Performance

Current Optimizations

  • Violations limited to 10 per rule (from 1000) for faster processing
  • Async operations with FastAPI background tasks
  • SSE streaming for real-time progress without polling overhead
  • In-memory rule storage for quick access
  • BigQuery optimization with parameterized queries

Recommended Settings

For production:

  • Increase VIOLATION_LIMIT based on requirements
  • Enable caching for repeated scans
  • Use BigQuery slots for guaranteed capacity
  • Implement rate limiting for Vertex AI calls

πŸ“ Development Notes

Code Quality

  • Type Safety: TypeScript in frontend, Pydantic in backend
  • Error Handling: Comprehensive try-catch with detailed logging
  • API Patterns: Consistent APIResponse wrapper for all endpoints
  • Data Models: Strict schema validation on both ends

Recent Improvements

  • βœ… Full refactoring (3,740+ lines across 21 files)
  • βœ… Removed all mock data, integrated real GCP services
  • βœ… Fixed API parameter mismatches (domain β†’ dataset)
  • βœ… Updated data models for consistency
  • βœ… Optimized violation detection (10 per rule)
  • βœ… Enhanced error handling and validation
  • βœ… Secured GCP credentials in gitignore

πŸš€ Deployment

Production Checklist

  •  Set DEBUG=False in backend/.env
  •  Configure production CORS origins
  •  Use production GCP project
  •  Enable Cloud Logging
  •  Set up Cloud Monitoring alerts
  •  Configure Cloud Load Balancing
  •  Use Cloud Run or GKE for backend
  •  Deploy frontend to Firebase Hosting or Cloud Storage + CDN
  •  Set up Cloud Armor for DDoS protection
  •  Enable Cloud IAP for access control

For detailed deployment instructions, see REFACTORING_SUMMARY.md


🀝 Contributing

Contributions welcome! Please:

  1. Fork the repository
  2. Create a feature branch (git checkout -b feature/amazing-feature)
  3. Commit changes (git commit -m 'Add amazing feature')
  4. Push to branch (git push origin feature/amazing-feature)
  5. Open a Pull Request

 

This build was uploaded as a hackathon project

Hackathon

HackFest 2.0

View All Projects
Give a star to encourage!Discussion
Start a new conversation!
Login to join the discussion
Updates
  • Go Through Readme File in Github
    Sunday, Feb 22nd, 2026
  • Go Through Readme File in Github
    Sunday, Feb 22nd, 2026