What you get in the generated ZIP
A typical analytics-dashboard generation includes:
app/blueprints/
├── metric_bp.py # registered metric definitions
├── aggregate_bp.py # materialised aggregate tables
├── dashboard_bp.py # user-saved dashboards
├── widget_bp.py # widget config (metric + chart type + filters)
├── filter_bp.py # named filter sets per workspace
└── export_bp.py # CSV / PDF export
app/models/
├── metric.py # name, sql_query, refresh_interval
├── aggregate_metric_daily.py # materialised daily rollup
├── aggregate_metric_hourly.py# materialised hourly rollup
└── dashboard.py # user_id, workspace_id, layout JSON
app/services/
├── metric_refresh.py # Celery Beat refreshes aggregates
└── query_executor.py # workspace-scoped, parameterised, no SQL injection
What's already wired
- Materialised aggregates: every metric defines a refresh interval; the Celery Beat task wakes up and recomputes the aggregate table. Saves the production read replica from being hammered by dashboard queries.
- Workspace scoping: every query in
query_executor.pyinjects theworkspace_idfilter. Cross-tenant data leakage is impossible by construction (no raw SQL outside the executor's allowlist). - Time-series: hourly and daily rollup tables, with retention policies. Default 90 days hourly + 2 years daily; configurable per metric.
- Cohort analytics:
users active in period N who were also active in period N-1style queries are first-class citizens — there's acohort_query()helper inquery_executor.py. - Frontend: Next.js + shadcn dashboard UI with Recharts. Drag-to-rearrange widget grid (using react-grid-layout). Filters apply across all widgets in a dashboard.
- Export: CSV from any widget, PDF of the entire dashboard via headless Chrome.
- Role-scoped data: viewers see only their workspace; admins see cross-workspace; superadmins see all (and every superadmin query is audit-logged).
What ships in docs/
docs/decisions/ADR-0009-materialised-aggregates.md— chose materialised tables + scheduled refresh over real-time queries; rejected alternatives discusseddocs/decisions/ADR-0013-time-series-retention.md— retention defaults and how to overridedocs/diagrams/data-pipeline.md— Mermaid diagram of source → aggregate → dashboard flow
Internal links
- PostHog integration for product analytics overlay
- for/vp-engineering covers reporting at organisational scale
CTA
Try it — free plan, no credit card. archiet.com.
Generate an analytics dashboard, look at the materialised-aggregate refresh and the workspace-scoped queries, decide if that's the data architecture you'd ship.