Every modern vendor has Sentry for errors and PostHog (or Mixpanel, or Amplitude) for product analytics. We did too. And every modern vendor sends those events to a third-party cloud — which means your error stack traces, your user interaction events, and (sometimes inadvertently) your customer data goes to a SaaS dashboard the customer can't see.
That bothered us. So we built our own.
What it is
apps/observability/ in our repo is a pure-Node HTTP service that:
- Listens on
:9999by default - Accepts Sentry envelopes at
/api/<project-id>/envelope/— the same wire format the official Sentry collector accepts - Accepts PostHog events at
/e/,/capture/,/array/<token>/config,/flags/— the endpoints the PostHog JS SDK calls - Stores everything in
apps/observability/data/events.ndjson— a single newline-delimited JSON file - Serves a dashboard at
/showing the live stream with filters
Zero dependencies beyond Node. No SQLite, no Docker, no external services. About 350 lines of TypeScript.
How the platform uses it
Point the Sentry SDK at the local collector with one env var:
VITE_SENTRY_DSN=http://localcollect@collector.asureglobal.example:9999/1 SENTRY_DSN=http://localcollect@collector.asureglobal.example:9999/1 VITE_POSTHOG_KEY=phc_local VITE_POSTHOG_HOST=https://collector.asureglobal.example
That's it. Errors, transactions, page views, custom analytics events all flow to the local collector. No code change in the app.
Why local-first matters
Data sovereignty. Customers running on-prem or in regulated environments don't want their telemetry leaving their network. With the local collector, it doesn't.
Development speed. Real errors during local dev show up in a local dashboard immediately. No "save the stack trace and paste it in Slack" workflow.
Vendor lock-in resistance. If we ever wanted to switch error tracking away from Sentry's wire format, the abstraction is already there — we point the SDK at the local collector, and the collector handles the parsing.
Auditability. Every Sentry envelope and PostHog event is a JSON line on disk. Customer security teams can grep, audit, and replay if needed.
What we vendored
The collector parses both wire formats against the official documentation we vendored at _vendors/. The Sentry envelope format is per the spec in _vendors/sentry-docs; the PostHog event format is per _vendors/posthog-js.
When upstream specs change, we update the collector's parser. When the collector evolves features (better filtering, full-text search, persistent storage), the customer's existing wire format keeps working.
How to verify it works
There are two Playwright proof specs that drive this end-to-end:
tests/proofs/09-local-collector.proof.spec.ts— triggers a real Sentry error and a real PostHog page view from the platform, then queries the collector's/api/eventsendpoint to assert the envelope landed.
Both green. See /proof for the test catalogue.
How to use it yourself
Clone our repo. Run bun --filter @asure/observability dev. Open https://collector.asureglobal.example/. Point any Sentry-compatible SDK at it.
If you want to keep using cloud Sentry / cloud PostHog alongside our collector, fork it and forward envelopes after capturing. That's a 20-line patch.
We're not anti-cloud. We're anti-"your data goes wherever we say." The collector is the line.