apps/product-analytics: a standalone Node 22 service (hono, pg, fflate, jose)
that speaks the public SDK capture protocol (/e/, /i/v0/e/, /batch/,
/capture/, /engage/, /groups/, /flags/?v=2, /decide/, /array/:token/config)
over JSON, gzip, base64 and form data, stores into Postgres (monthly
partitions, RLS on pa.project_id plus a bound project_id), resolves people
with identify/alias/merge semantics ported from the upstream persons code
(MIT, cbb1e9253027), applies the console caps (byte copy, drift-tested),
meters scribase.analytics.events behind RAILYARD_LIVE, drops IPs, runs
privacy deletions as visible jobs and trims to each plan's window.
Hand-offs created now (empty on purpose):
- src/routes.ts mounts src/insights/routes.ts -> A2
- src/routes.ts mounts src/{replay,heatmaps,surveys,experiments,exports}/routes.ts -> A3
- src/remote-config/sections.ts (replay, heatmaps, surveys providers) -> A3
- src/flags/variants.ts (returns null) -> A3
- src/replay/gdpr.ts and src/surveys/gdpr.ts privacy hooks -> A3
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
13 lines
588 B
SQL
13 lines
588 B
SQL
-- Per-project settings the console edits and remote config reads.
|
|
|
|
create table if not exists pa.project_settings (
|
|
project_id uuid primary key,
|
|
org_id uuid not null,
|
|
require_consent boolean not null default true,
|
|
autocapture boolean not null default true,
|
|
capture_pageview boolean not null default true,
|
|
flags_client_key text check (flags_client_key ~ '^ry_flags_[A-Za-z0-9_-]{24,64}$'),
|
|
retention_days integer check (retention_days between 1 and 3650),
|
|
updated_at timestamptz not null default now()
|
|
);
|