Skip to content

System Architecture

Fabrizio Degni edited this page Jul 8, 2026 · 1 revision

System Architecture

PolicyWatcher is composed of a public application, an admin control plane, a persistent database and optional VPS companion services.

High-Level Architecture

flowchart LR
    public["Public Workspace<br/>dashboard, timeline, reports"] --> app["Next.js App"]
    admin["Admin Console<br/>QA, cron, review, VPS ops"] --> app
    app --> db["SQLite / Prisma<br/>evidence store"]
    app --> gemini["Gemini AI<br/>structured analysis"]
    app --> renderer["VPS Renderer<br/>Playwright retrieval"]
    app --> archive["Wayback / Common Crawl<br/>fallback evidence"]
    renderer --> source["Provider Policy Sources"]
    app --> source
Loading

Runtime Zones

Zone Purpose
Hostinger application Next.js app, public UI, admin UI and API routes
Persistent database SQLite file stored outside the extracted app source directory
VPS renderer Optional Playwright service for script-rendered policy pages
VPS operations agent Optional backup, smoke-check, update and rollback control plane
External sources Provider-owned policy URLs and archive fallbacks

Design Boundary

Public inspection, admin authority and retrieval capability remain separate trust zones. Public users can inspect evidence-gated outputs; admins can run scans and manage QA; the VPS renderer performs controlled retrieval and does not expose arbitrary browser control to users.

Core Data Chain

erDiagram
    Company ||--o{ Policy : owns
    Policy ||--o{ PolicySnapshot : versions
    Policy ||--o{ PolicyCheckLog : checks
    PolicySnapshot ||--o{ PolicyChange : oldSnapshot
    PolicySnapshot ||--o{ PolicyChange : newSnapshot
    PolicyChange ||--o{ RegionImpact : impacts
    Policy ||--o{ DatasetQaIssueReview : qa_decisions
    AdminAccessLog }o--|| AdminUser : records
Loading

Main Routes

  • / public dashboard
  • /timeline policy movement timeline
  • /leaderboard Policy Signals Board
  • /trust quality evidence page
  • /methodology/confidence public methodology
  • /admin admin panel
  • /admin/cron scan manager
  • /admin/dataset-quality Dataset QA
  • /admin/vps-services VPS companion service monitoring

Clone this wiki locally