feat: polished first-party analytics SDKs + Harbor demo - #2
Closed
altitudems wants to merge 10 commits into
Closed
Conversation
added 10 commits
July 15, 2026 23:22
Move the analytics library into packages/analytics with Vite library builds, Vitest, ESLint 9 flat config, and TypeScript 5.9. Refresh CI and release workflows for the workspace layout and rename the package scope to @altitudems/analytics.
Drop legacy lint/format/build tooling in favor of Biome for lint+format and tsdown (Rolldown) for the library build. Vitest 4 covers tests; CI scripts updated accordingly.
Replace uuid, bowser, and @medv/finder with crypto.randomUUID, Client Hints + UA parsing, and a small CSS selector helper. Swap jsdom for happy-dom so the published package has zero dependencies.
Replace Biome with Vite+ so validation uses `vp check` and `vp fmt` (Oxlint/Oxfmt). Library builds go through `vp pack`, tests through `vp test`, and CI runs the vp workflow.
Replace the old in-memory event client with a thin product/marketing SDK: capture/page/identify, first-touch UTMs, batched ingest payload, beacon flush on unload, and opt-out. Zero runtime dependencies.
Add a pluggable server package (store interface, MemoryStore, fetch ingest handler, Hono helpers) plus example API, marketing site, and fake app that demonstrate first-party capture end to end.
Harden the browser SDK (SPA pageviews, sessions, transport backoff, destroy, deep ingest validation) and server ingest (limits, write-key headers, richer stats). Replace split examples with one Vite demo so marketing → app shares identity, plus a calmer Harbor marketing page.
Out-of-the-box dashboard at /dashboard.html with Lit web components polling /stats and /events for live tiles, rankings, and an event feed.
Boot the API with Harbor seed history, push inserts over /stream, and keep synthetic traffic flowing so the Lit dashboard looks alive.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
First-party analytics monorepo: browser SDK, pluggable ingest server, and a same-origin Harbor demo.
Packages
@altitudems/analytics— SPA-aware client (pageviews, UTMs, batch + beacon, identify/reset)@altitudems/analytics-server—createIngestHandler/ Hono helpers +MemoryStorefor demosseedHarborDemo+startHarborTrafficfor out-of-the-box busy data/streamSSE (snapshot + live batches)Demo (
pnpm dev)Open the dashboard first — it boots with seeded history and an SSE live feed (synthetic traffic keeps ticking; real marketing/app events stream in too). Falls back to polling if SSE drops. Set
HARBOR_LIVE_TRAFFIC=0to disable the generator.Tooling is Vite+ (
vp check/vp test/vp pack).