Context
The headline promise: integrate a best-practices Laravel or Stacks app (#7, #8) and reports appear on their own. A template registry maps the standard event taxonomy (docs/events.md, #6) to prebuilt report definitions; when a project first receives matching events, the matching reports are provisioned automatically.
Scope
- Template registry
app/Reports/templates/: typed report definitions (name, blocks with query + viz + layout, required event names, minimum property requirements), versioned with atemplate_key+ version. Ship at minimum:- Commerce overview: revenue over time, orders, AOV, refund rate, top products, conversion funnel (
commerce.*). - Customers: new customers, repeat rate, revenue per customer cohort (needs
user_keyon commerce events). - Users: signups over time, DAU/WAU/MAU from
user.login/activity, simple weekly retention grid (heatmap block). - Content (if
cms.*events present): posts published, views by post if provided.
- Commerce overview: revenue over time, orders, AOV, refund rate, top products, conversion funnel (
- Provisioning: a queued job (triggered from ingest on first-seen event names, debounced) instantiates matching templates as
Reportrows withorigin: 'template'+template_key(#9) - idempotent (never re-create one the user deleted; store a per-project template ledger, as a model). - User control: auto-created reports are fully editable (editing forks them to
origin: 'user'semantics - decide and document the exact fork/update behavior); a project setting disables auto-creation; deleting is respected forever. - Template upgrades: bumping a template version must not clobber user edits; untouched template reports may offer a visible "update available" refresh.
- Templates render correctly against partial data (missing optional events degrade blocks to their designed empty states, #11).
- The builder's empty state (#12) offers these same templates as manual starting points.
- Feature tests: first-event provisioning, idempotency after delete, debounce under a burst of first events, version-bump behavior.
Acceptance
- Point the demo Laravel app (#8) or a seeded Stacks emitter (#7) at a fresh project: the Commerce and Users reports appear within a minute, render with real numbers, and deleting one keeps it deleted after more events arrive.
Depends on #6, #9, #10; exercised by #7, #8. Part of #1 (M5 Integrations and auto-reports). Ground rules: see #1.