Skip to main content

Architecture Overview

Technical architecture of the Sentry Analytics platform.

🏗️ System Architecture

┌─────────────────────────────────────────────────────────────┐
│ FRONTEND │
│ React 19 + Vite + Tailwind + Framer Motion │
│ ├── Dashboard (company analysis) │
│ ├── Chat Widget (AI Agent) │
│ └── Knowledge Base (Docusaurus) │
└───────────────────────────┬─────────────────────────────────┘
│ HTTPS
┌───────────────────────────▼─────────────────────────────────┐
│ BACKEND API │
│ FastAPI + Python 3.11 + Uvicorn │
│ ├── /api/company/* (Corporate endpoints) │
│ ├── /api/ai/* (AI Chat endpoints) │
│ ├── /api/agent/* (Agent Tools endpoints) │
│ ├── /api/scraping/* (Scraping management) │
│ └── /api/v2/crypto/* (Crypto module) │
└───────┬──────────────────┬──────────────────┬───────────────┘
│ │ │
┌───────▼───────┐ ┌───────▼───────┐ ┌───────▼───────┐
│ PostgreSQL │ │ Vertex AI │ │ External │
│ Cloud SQL │ │ Gemini 2.5 │ │ APIs │
│ ├── reviews │ │ ├── Chat │ │ ├── Kununu │
│ ├── companies│ │ ├── RAG │ │ ├── Google │
│ └── jobs │ │ └── Function │ │ ├── Reddit │
└───────────────┘ └───────────────┘ └───────────────┘

🛠️ Technology Stack

Backend

ComponentTechnology
FrameworkFastAPI (Python 3.11)
ServerUvicorn (ASGI)
DatabasePostgreSQL 17 (Cloud SQL)
ORMSQLAlchemy 2.0
MigrationsAlembic
AIVertex AI (Gemini 2.5)

Frontend

ComponentTechnology
FrameworkReact 19
Build ToolVite
StylingTailwind CSS
StateTanStack Query
ChartsNivo + Recharts
AnimationsFramer Motion

Infrastructure

ComponentTechnology
HostingGoogle Cloud Run
DatabaseCloud SQL PostgreSQL
AI ServicesVertex AI
SecretsSecret Manager
MonitoringCloud Logging
CI/CDGitHub Actions

📁 Project Structure

Vartovii/
├── backend/
│ ├── main.py # FastAPI app entry
│ ├── ai/ # AI services
│ │ ├── config.py # Model configuration
│ │ ├── client.py # Gemini client
│ │ ├── prompts/ # System prompts
│ │ ├── services/ # Chat, sentiment, report
│ │ └── rag/ # RAG corpus management
│ ├── api/ # API routers
│ ├── models/ # SQLAlchemy models
│ ├── services/ # Business logic
│ └── scrapers/ # Data collection

├── dashboard_app/
│ ├── src/
│ │ ├── components/ # React components
│ │ ├── pages/ # Route pages
│ │ ├── hooks/ # Custom hooks
│ │ └── api/ # API client
│ └── public/ # Static assets

├── knowledge-base/ # Docusaurus docs
│ ├── docs/ # Documentation files
│ └── docusaurus.config.js # Configuration

├── docs_site/ # Landing page
└── docs/ # Internal docs (RAG indexed)

🔄 Data Flow

Company Analysis

1. User searches "BMW"
└── Frontend → GET /api/search/smart?q=BMW

2. Smart Search checks freshness
└── Backend → Database query
└── If stale → Trigger scraping jobs

3. Return company data
└── Backend → Frontend
└── Display dashboard with Trust Score

AI Chat

1. User sends message
└── Frontend → POST /api/ai/chat

2. Gemini analyzes intent
└── Keywords detected? → Function Calling
└── No keywords → Direct response

3. Tool execution (if needed)
└── search_company, get_trust_score, etc.
└── API calls to database

4. Response formatted
└── Backend → Frontend
└── Display in chat widget

🔐 Security

  • Authentication: API key for agent endpoints
  • Authorization: IAM-based access control
  • Encryption: HTTPS everywhere, at-rest encryption
  • Secrets: Google Secret Manager

📊 Performance

MetricTargetActual
API Response (cached)under 100ms~50ms
API Response (DB)under 500ms~200ms
Chat Responseunder 3s~1.5s
Page Loadunder 2s~1.2s

See Database Schema for detailed data models.