Skip to content

feat(web): add PostHog analytics with typed env + refresh README - #37

Draft
PunGrumpy wants to merge 3 commits into
mainfrom
feat/launch-followups
Draft

feat(web): add PostHog analytics with typed env + refresh README#37
PunGrumpy wants to merge 3 commits into
mainfrom
feat/launch-followups

Conversation

@PunGrumpy

@PunGrumpy PunGrumpy commented Aug 7, 2026

Copy link
Copy Markdown
Owner

Problem

The docker-doctor site had no presence in PostHog — its only analytics is Databuddy, which has no programmatic query surface, so launch traffic after the X announcement couldn't be tracked or dashboarded alongside the rest of the workspace's data. On top of that:

  • Environment variables were read straight off process.env with no validation — Databuddy silently mounted with an undefined client ID when the env var was missing.
  • The README undersold the tool to launch visitors: no example output anywhere, a stale rule count ("21+" vs 25 actual), a CI section that duplicated the quick-start command verbatim, and an API section that was two bare import lines.

Result

Analyticsposthog-js initializes in production via a client provider and reports through /ingest rewrites so requests survive tracking blockers. A pinned Docker Doctor Launch dashboard (daily visitors, referrers, channels, top pages — all scoped to $host = docker-doctor.vercel.app) is already in PostHog and starts populating on deploy.

Typed env@t3-oss/env-nextjs + zod schema in lib/env.ts: NEXT_PUBLIC_POSTHOG_KEY must be a phc_ token (defaults to the public project token), NEXT_PUBLIC_DATABUDDY_CLIENT_ID is optional and Databuddy now mounts only when it's set. next.config.ts imports the schema, so invalid env fails the build instead of surfacing at runtime.

README — real scan output captured from an actual run under Quick start, rule count corrected to 25, CI section shows genuine pipeline usage (--json report artifact, --score gating), and the API section is a working example verified to produce the same 68/100 score as the CLI. Changeset included since the npm README ships with @docker-doctor/cli.

Verified: full turbo run build + 101 tests + typecheck green via the pre-commit hook.

🤖 Generated with Claude Code

PunGrumpy and others added 2 commits August 8, 2026 01:02
Initializes posthog-js in production via a client provider and proxies
ingestion through /ingest rewrites so requests survive tracking blockers.
Scoped dashboard lives in the existing PostHog CLI project.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
@vercel

vercel Bot commented Aug 7, 2026

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
docker-doctor Ready Ready Preview Aug 7, 2026 6:13pm

@github-actions

github-actions Bot commented Aug 7, 2026

Copy link
Copy Markdown
Contributor

React Doctor found 1 new issue in 1 file · 1 error · score 40 / 100 (Critical) · 0 fixed · vs main

Errors

Reviewed by React Doctor for commit e822255. See inline comments for fixes.

Replaces raw process.env access with a validated schema in lib/env.ts:
NEXT_PUBLIC_POSTHOG_KEY must be a phc_ token (defaults to the public
project token), NEXT_PUBLIC_DATABUDDY_CLIENT_ID is optional and Databuddy
now only mounts when it is set. next.config.ts imports the schema so
invalid env fails the build instead of surfacing at runtime.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Comment thread apps/web/package.json
"motion": "^12.42.2",
"next": "16.2.11",
"next-themes": "^0.4.6",
"posthog-js": "^1.414.0",

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

React Doctor · socket/low-supply-chain-score (error)

posthog-js@1.414.0 (lowest version "^1.414.0" allows) scored 36/100 on Socket's supply chain axis (minimum 50). This points to risky install-time behavior — install scripts, obfuscated or native code, network/filesystem/shell access, or typosquatting. Other axes — vulnerability 100, maintenance 100, quality 80, license 100.

Fix → Confirm this is the package you meant to install, and prefer a more established, audited alternative; update "posthog-js": "^1.414.0" in package.json. Full report: https://socket.dev/npm/package/posthog-js/overview/1.414.0. If you've reviewed and accepted this package, raise supplyChain.minScore (currently 50) or set supplyChain.severity: "warning".

Docs

@PunGrumpy PunGrumpy changed the title Launch follow-ups: PostHog analytics + README refresh feat(web): add PostHog analytics with typed env + refresh README Aug 7, 2026
@PunGrumpy
PunGrumpy marked this pull request as draft August 11, 2026 09:01
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant