App template
Analytics dashboard
See how a product is doing and why: key numbers against the period before, charts you can click into, funnels, retention, users and events, all narrowed to one segment.
Use this template
Installs the whole app into your project: its pages, routes, services with sample data, agent tools and the browser entry. Every file is yours to edit.
npx shadcn@latest add checkfu/uicontext/analytics- Run itLoad from your page’s script. It builds the app with
createApp: the browser’s router, the agent tools, an offline notice, and sign-in when you turn it on. Inside an app that already routes, renderAnalyticsTemplate, which brings its own in-memory router. - Connect your backendEvery read and write goes through
Analyticsin . Implement it over your API and pointAnalyticsLiveat your Layer. - Make it yoursPages are one file per route. Delete the ones you don’t need, and the sample data in .
Screens
Overview
/Five numbers with their change and trend, revenue and active users by day, top pages and sources. Click a day or a source to narrow every report.
Funnels
/funnelsSignup to paid, step by step, and weekly retention cohorts.
Users
/usersEveryone in the segment, searched, sorted and paged; one opens in a drawer with its own link.
Events
/eventsEvery event with its trend; one by day, by dimension and its latest occurrences.
Settings
/settingsTeam, API keys and billing.
Where your backend plugs in
Pages never call a backend. They read through the queries in queries/ and write through Commands kept beside the component that runs them; both capture the Analytics service. Implement its interface in over HTTP, a sync engine or a database client, then change one line:
export const AnalyticsLive = Analytics.sample
// becomes your Layer, such as
export const AnalyticsLive = Layer.effect(Analytics, makeHttpAnalytics)The root provides it once, so every page shares one instance. Sign-in is one line: delete auth: false in once your backend serves the session routes, and the sidebar shows who signed in.
What to delete
- services/generate.ts, and Analytics.sample in services/Analytics.ts
To drop a screen, delete its file in pages/ and its route in ; TypeScript points at every link that still prints it. The agent tools are in .