You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Commit f445982
Browse filesBrowse the repository at this point in the historyBrowse files
Copy file name to clipboardExpand all lines: AGENTS.md
+17-3Lines changed: 17 additions & 3 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -5,9 +5,13 @@
5
5
6
6
Every UI change (views/, public/css, new components) MUST follow DESIGN.md: colors, type, radii, spacing tokens. No ad hoc palette or font choices.
7
7
8
+
Account, organization, teams, administrator, login and signup pages must preserve the local Rybbit reference's complete page composition, widths, spacing, sidebars, tabs and auth form/step layouts. Import the original pages and layouts; do not replace them with custom page shells. Limit adaptations to MetriBee branding, GA4/SQLite data and the required map-boundary source.
9
+
10
+
Property organization moves and person-to-person transfers live in the native Site Settings dialog's General tab, reachable from the property sidebar and Home cards. Preserve its original desktop shell, settings sections and move confirmation; GA4 names/domains are read-only and unsupported collector controls are omitted. Legacy `/property-access` links open this dialog on the matching analytics page. Footer retains Rybbit's 1100px content width, 140px logo, three columns, support-action area and bottom-bar layout with MetriBee branding and valid project links.
11
+
8
12
## Stack
9
13
10
-
Express serves GA4 APIsand the analytics workspace. Following the owner's October 22, 2026 instruction, all user-facing pages use the native Rybbit React UI in `frontend/`, built by Vite into `public/ui/`. Reuse imported `frontend/rybbit/src/components/ui`, site, journeys and retention components; do not recreate controls in Handlebars or mix in the legacy panel palette. GA4 controllers and quota/auth logic remain on the server. Home (including Sites report views), Globe, quota, connection and GA4-specific reports compose those same components in `frontend/adapter/`. Preserve every GA4 data capability when adapting presentation. Do not add user-account or Documentation menus.
14
+
Fastify serves GA4 APIs, Better Auth and the analytics workspace. SQLite stores application and authentication data; Express is not used. Following the owner's October 22, 2026 instruction, all user-facing pages use the native Rybbit React UI in `frontend/`, built by Vite into `public/ui/`. Reuse imported `frontend/rybbit/src/components/ui`, site, journeys and retention components; do not recreate controls in Handlebars or mix in the legacy panel palette. GA4 controllers and quota/auth logic remain on the server. Home (including Sites report views), Globe, quota, connection and GA4-specific reports compose those same components in `frontend/adapter/`. Preserve every GA4 data capability when adapting presentation. Reuse native Rybbit account, organization, team and system-admin controls. Do not add a Documentation menu.
11
15
12
16
Home combines the original Rybbit site cards with Status, Table and Heatmap tabs. All four views share search, tag/team filters, date selection and comparison periods. Keep the view tabs, update time and date controls in one desktop toolbar row. Status, Table and Heatmap query the shared GA4 report cache for the selected dates; saved AdSense values appear only when they fully cover the selected period. Home offers optional account grouping across all four views; Realtime stays ungrouped. Property names/account metadata refresh every five minutes independently of report caches, with a manual Sync properties action on Home. Legacy `/sites` links redirect to the matching Home tab.
13
17
@@ -21,19 +25,29 @@ Widgets are managed on their own property-scoped `/widgets?prop=ID` page, reacha
21
25
22
26
Run `pnpm build:ui` after changing frontend source, `pnpm dev:ui` to watch, and `pnpm typecheck:ui` to check it. `pnpm build` builds both server TypeScript and UI. Imported code and modifications retain their Rybbit AGPL license and attribution in `frontend/third-party/`.
23
27
28
+
UI builds retain previous hashed assets so open tabs can keep importing their scripts. Do not clean `public/ui` while serving existing pages. HTML shells use `Cache-Control: no-store` and provide a startup/reload fallback. Authentication browser QA must use a separate database and a different hostname from the user's preview (for example `127.0.0.1` versus `localhost`); different ports alone do not isolate login cookies.
29
+
24
30
## Credentials
25
31
Env only, never a key file. Both the app and `mcp-server/` read `GA4_CLIENT_EMAIL` and `GA4_PRIVATE_KEY` (quoted, `\n` escaped) from the root `.env` through `lib/credentials.js`. Optional: `PSI_API_KEY`, `PORT`.
26
-
- Until both are set (or `DEMO=1`), pages redirect to `/setup` and `/api/*` returns 503 `not_configured` (gate in `app.js`). The server re-reads `.env` on each check, so no restart is needed.
32
+
- Until both are set (or `DEMO=1`), pages redirect to `/setup` and `/api/*` returns 503 `not_configured` (authenticated setup gate in `app.js`). The server re-reads `.env` on each check, so no restart is needed.
- Setup prompt, manual steps and MCP prompt live in `SETUP.md` between markers; `/setup` reads them from there. Edit text there, not in the view.
29
35
- One `pnpm install` at the root covers the MCP server (`pnpm mcp`).
30
-
- MCP uses the stable v2 SDK and Streamable HTTP only. The dashboard mounts`/mcp`before its setup/boot gates; `pnpm mcp` serves the same tools separately on `MCP_HOST`/`MCP_PORT` (default `127.0.0.1:5484`). Client configs use an HTTP URL, never a node/stdio command. Keep the per-request server factory and shared cache/quota modules.
36
+
- MCP uses the stable v2 SDK and Streamable HTTP only. The dashboard registers`/mcp`independently of its setup/boot gates; MCP requires a scoped API key or OAuth bearer token (or a same-origin signed-in session); `pnpm mcp` serves the same tools separately on `MCP_HOST`/`MCP_PORT` (default `127.0.0.1:5484`). Client configs use an HTTP URL, never a node/stdio command. Keep the per-request server factory and shared cache/quota modules.
31
37
- High-level MCP tools in `mcp-server/lib/dashboard.js` reuse native dashboard controllers, caches, funnel/widget stores and GA4 clients. New analytics features should be reflected in the MCP capability catalog and tools. Guard every uncached GA4 call, keep each analysis on one property, and never bypass quota protection through native helpers. Results include structured content and explicit truncation; local definition writes need read/write annotations. Demo MCP data must not read/write live quota or mix with live tool caches. Sharing keys and enablement are not MCP operations.
32
38
33
39
Optional supplemental user OAuth lives in lib/supplementalAuth.js and is shared by the dashboard,
34
40
MCP server and snapshot script. Credentials stay in .env. Only explicit numeric account/property
35
41
allowlists use OAuth; its only scope is analytics.readonly. See SETUP.md.
36
42
43
+
## Users and SQLite
44
+
45
+
Better Auth 1.7.3 owns authentication at `/api/auth`; `lib/auth.mjs` generates its SQLite schema. `lib/database.js` applies idempotent application migrations. The first registered user becomes a system administrator and owner of the default organization; connected GA4 properties are assigned there initially. New organizations receive no properties automatically. Reuse Rybbit's five roles and scope taxonomy in `lib/permissions.js` and `lib/scopes.js`. All HTTP and MCP entry points must enforce the same organization/property grants, including legacy APIs and aggregate caches. Never trust browser role, organization or property claims. Private links and explicitly enabled embeds retain their separate public read guards.
46
+
47
+
`DATABASE_PATH` defaults to `.data/metribee.sqlite` (demo: `.data/metribee-demo.sqlite`). Funnels, Widgets and private-link settings are transactionally stored in SQLite; valid legacy JSON documents migrate automatically without deleting originals or changing IDs/keys. Report caches, GA4 quota ledgers and supplemental Google credentials keep their existing formats and guards. Use `pnpm db:migrate`, `pnpm db:check` and `pnpm db:backup`; an online backup includes WAL contents. Persist `.data`, run one app database on a local filesystem, and do not store GA4 service-account credentials in it. Mail uses SMTP or Resend; browser login OAuth credentials are separate from supplemental GA4 OAuth.
48
+
49
+
Public Analytics is an opt-in property setting in Site Settings → General. Its SQLite flag is independent of private links and widget publishing. Anonymous access uses the report allowlist in `lib/publicDashboard.js`, checks enablement before cached reports, filters metadata to one property, hides private segments/annotations and workspace identities, and never grants organization, management, GSC or MCP access. Keep public browser report caches separate from signed-in workspace persistence.
50
+
37
51
## Tests
38
52
`pnpm test` runs mocha on `test/**/*.test.js`. Run once before commit, not after every edit.
Copy file name to clipboardExpand all lines: CHANGELOG.md
+19Lines changed: 19 additions & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -5,6 +5,25 @@ The format follows [Keep a Changelog](https://keepachangelog.com/en/1.1.0/), and
5
5
6
6
## [Unreleased]
7
7
8
+
### Added
9
+
10
+
- Add optional GA4 BigQuery export support for real two-to-ten-step Journeys, path sessions, event timelines and MCP reports, with property-scoped configuration and scan/daily budgets.
11
+
- Add Rybbit's Public Analytics switch, shareable public dashboard URLs and property-scoped anonymous reports, with immediate revocation and existing private links preserved.
12
+
- Align saved segments, chart annotations, Goals, custom Dashboards, PDF exports and weekly email reports with Rybbit’s native UI, with SQLite persistence, GA4 adapters, scoped permissions and MCP tools.
13
+
- Add Better Auth accounts, sessions, email verification and recovery, optional Google/GitHub sign-in, organizations, invitations, teams, five access roles, property grants, administrator tools and scoped personal/organization API keys.
14
+
- Connect MCP clients through OAuth with PKCE and explicit consent; enforce the same property permissions across dashboard and MCP requests.
15
+
- Store accounts and saved definitions in SQLite, automatically import legacy JSON without changing existing share/widget links, and provide online backup and integrity checks.
16
+
- Add opt-in Cloud organization subscriptions through Waffo Pancake, with hosted checkout, plan changes, cancellation and invoices; self-hosted deployments keep billing disabled by default.
17
+
18
+
### Changed
19
+
20
+
- Replace Express with Fastify for the dashboard and standalone MCP server while preserving GA4 report caches and quota safeguards.
21
+
- Preserve native Rybbit account, organization, administrator and authentication layouts, restore Site Settings property moves, and retain previous UI assets with a startup/reload fallback for open tabs.
22
+
23
+
### Fixed
24
+
25
+
- Open the available GA4 page-transitions report directly on Journeys instead of showing unavailable session controls and a source-required screen.
Copy file name to clipboardExpand all lines: DESIGN.md
+5-1Lines changed: 5 additions & 1 deletion
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -232,8 +232,12 @@ This system is **flat by default**. There is no resting shadow vocabulary; depth
232
232
233
233
## MetriBee integration
234
234
235
+
Site settings reuse Rybbit's native dialog shell and General-tab sections, including organization moves and their confirmation dialog. Do not introduce a separate Property access page; keep old URLs compatible by opening the native dialog. GA4 metadata is read-only and unsupported collector controls are omitted. Keep Widgets standalone. The Footer preserves the original 1100px width, 140px logo slot, three-column grid, support-action area and bottom-bar alignment; adapt only branding and destinations to real MetriBee resources.
236
+
237
+
Account, organization, team, administrator, login and signup pages retain Rybbit's original complete page layouts and native controls. Keep the original content widths, margins, navigation composition, administrator tab order, two-column login and stepped signup. Use data adapters for GA4/SQLite and the approved map source, rather than redesigning these pages.
238
+
235
239
Search Console belongs in the existing Analytics page, country and device tables. Expose search metrics in the native column-header menu and alongside GA4 columns in the same expanded table; keywords use the existing Sources card. Main places search clicks, impressions, CTR and average position in the top native metric card, with selected-state tiles and sparklines that switch the existing main chart. Pages retains the four native StatBand summary cells alongside its integrated table.
236
240
237
241
Widget management lives on the standalone property-scoped Widgets page. Reuse the native sidebar, compact list rows, controls and shared Funnels editor; keep badges, metrics-only components and trend cards within one custom builder, without separate legacy embed tabs.
238
242
239
-
The owner requested native Rybbit UI reuse on October 22, 2026. The analytics workspace uses the original Rybbit theme and React components in `frontend/`, with GA4 data adapters. Main, Pages, Events, Journeys and Retention share one shell and control system. Retain original Radix keyboard behavior and motion presets. Do not add the legacy Instrument Panel palette or Handlebars controls to these pages. The default Home retains the original Rybbit Home/SiteCards and adds Status, Table and Heatmap tabs with shared search, dates and comparison periods. Keep tabs, update time and date controls in one desktop toolbar row. The site overview at `/analytics` merges GA4 reports into the native main chart and topical panels: reuse existing source, page, geography and technology panels rather than adding duplicate reports. Revenue, traffic quality and visitor segments use the same native tabbed cards. All historical panels share the overview's dates and filters. `/analytics/reports` is only a compatibility redirect. Sites reports live in Home; legacy `/sites` links redirect to the matching Home tab. Keep `/realtime`, Globe, quota and connection as distinct screens. No user menu or Documentation entry. The former design is archived at `docs/legacy-panel-design.md`. Imported source and license notices are in `frontend/third-party/`.
243
+
The owner requested native Rybbit UI reuse on October 22, 2026. The analytics workspace uses the original Rybbit theme and React components in `frontend/`, with GA4 data adapters. Main, Pages, Events, Journeys and Retention share one shell and control system. Retain original Radix keyboard behavior and motion presets. Do not add the legacy Instrument Panel palette or Handlebars controls to these pages. The default Home retains the original Rybbit Home/SiteCards and adds Status, Table and Heatmap tabs with shared search, dates and comparison periods. Keep tabs, update time and date controls in one desktop toolbar row. The site overview at `/analytics` merges GA4 reports into the native main chart and topical panels: reuse existing source, page, geography and technology panels rather than adding duplicate reports. Revenue, traffic quality and visitor segments use the same native tabbed cards. All historical panels share the overview's dates and filters. `/analytics/reports` is only a compatibility redirect. Sites reports live in Home; legacy `/sites` links redirect to the matching Home tab. Keep `/realtime`, Globe, quota and connection as distinct screens. Use the native Rybbit account, organization, team and administrator navigation and controls. No Documentation entry. The former design is archived at `docs/legacy-panel-design.md`. Imported source and license notices are in `frontend/third-party/`.
0 commit comments