Public docs
Architecture
How opSentry is built — modules, data flow, and design decisions.
Backend
opSentry runs on FastAPI (Python) with PostgreSQL for persistence.
Core modules:
app/main.py— routing, auth middleware, rate limiting, plan gatingapp/translator.py— deterministic changelog extraction and orchestrationapp/ai.py— GPT-4o-mini enrichment via OpenAIapp/db.py— raw SQL via psycopg (no ORM)app/auth.py— API key resolution and plan lookupapp/rate_limit.py— per-key sliding window enforcementapp/ingest_api.py— AI ingest pipeline with partner auto-matchingapp/alerts_api.py— alert CRUD and lifecycle endpointsapp/partners_api.py— partner map upload, normalization, CRUDapp/team_api.py— workspace membership managementapp/apps_api.py— app credential management
Frontend
Next.js (App Router) with React and TypeScript. State is managed with React hooks only — no Redux, no Zustand. Data fetching uses native fetch().
Database
PostgreSQL (raw SQL via psycopg2 — no ORM). Tables span the core domains: users, workspaces, sessions, alerts, apps, the partner map (partner_uploads, partner_mappings), partner onboarding, integration config (GitHub / Jira / HubSpot / Slack / Postman), billing, and the legacy translator log.
Alert lifecycle model
Alerts have no explicit status column. Status is derived:
resolved_at = null→ Activeresolved_at = timestamp→ Resolved
AI layer
The AI layer uses GPT-4o-mini and is completely additive. Every endpoint that uses AI has a deterministic fallback — if AI is unavailable, the system still returns valid structured output. Nothing depends on AI being available.
Design principles
- Deterministic first, AI second
- No silent behavior — every alert has an explicit state
- Partner matching by scope intersection, not name string matching
- Plan-based feature gating — AI features scale by tier (Free / Pro / Enterprise)