Skip to content

feat: self-hosting, stats API, Next.js package, docs and README (Phases 6, 8, 9) - #9

Merged
masaok merged 3 commits into
mainfrom
phase-6-selfhost
Oct 4, 2026
Merged

masaok merged 3 commits into
mainfrom
phase-6-selfhost

Conversation

@masaok

@masaok masaok commented Oct 4, 2026

Copy link
Copy Markdown
Owner

Why

The public-repo parts of Phase 6 (self-host mode and integrations), Phase 8 (Google sign-in) and Phase 9 (README and docs).

Scope

  • Dockerfile, docker-compose.yml, scripts/start.sh: migrate, optionally seed, serve. docs/SELF_HOSTING.md covers both modes, a Deploy to Vercel button, Next.js, Astro and plain HTML snippets, and the proxy recipe.
  • GET /api/v1/stats?site=&range= with per-project bearer tokens (rotateApiToken; only the SHA-256 is stored).
  • packages/next: @copper-analytics/next with <CopperAnalytics siteKey host api dev />.
  • /docs in the web app, linked from the header.
  • README with the pitch, two screenshots, quickstart and both deploy modes.
  • Google sign-in needed no new code: the provider and account linking by verified email were already conditional on GOOGLE_CLIENT_ID and GOOGLE_CLIENT_SECRET.

Verification

  • pnpm verify passes.
  • Docker is not available on this machine, so docker compose up itself was not run. In its place, a fresh clone ran the container's exact steps (HUSKY=0 pnpm install --frozen-lockfile, pnpm turbo run build --filter=@copper/web, sh scripts/start.sh with COPPER_SEED=1) against an empty Postgres: serving after 18 s on a warm package store, with 5 seeded projects visible after signing in as the demo account.
  • Stats API on that instance: 200 with 7 daily points for range=7d; 401 for a wrong token, for another project's site key and for an unknown site; 400 for a bad range; after replacing the token the old one returned 401 and the new one 200.
  • With Google credentials set, the sign-in page showed both buttons and POST /api/auth/sign-in/social returned https://accounts.google.com/o/oauth2/v2/auth with the callback /api/auth/callback/google. The round trip needs real credentials and a person.

https://claude.ai/code/session_01X2rqistoob3eewaQAJVwr3

Adds a Dockerfile and docker-compose.yml for simple mode, a read-only
stats API with per-project tokens, @copper-analytics/next, a public /docs
page, docs/SELF_HOSTING.md and the launch README.

Claude-Session: https://claude.ai/code/session_01X2rqistoob3eewaQAJVwr3
Copilot AI balanced review requested due to automatic review settings October 4, 2026 08:17
@vercel

vercel Bot commented Oct 4, 2026 •

Copy link
Copy Markdown

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

Project Deployment Actions Updated
copper-analytics Ready Ready Preview Oct 4, 2026 8:18am UTC

Request Review

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Copilot was unable to review this pull request because the user who requested the review has reached their quota limit.

It takes about 6 s on a hosted runner and failed main at vitest's 5 s default.

Claude-Session: https://claude.ai/code/session_01X2rqistoob3eewaQAJVwr3
@masaok
masaok merged commit 0d995a0 into main Oct 4, 2026
8 checks passed
@masaok
masaok deleted the phase-6-selfhost branch October 4, 2026 17:35

This branch was successfully deployed

1 active deployment
Preview — 22f96ef0 Deployed Oct 4, 2026 by vercel[bot]
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.

2 participants