Every analytics tool wants a subscription. And your data. I built Twiligent instead. YouTube stats. Instagram stats. One dashboard. Runs locally on your machine.
docs: fix remaining setup and testing inaccuracies
spacesdrive1da9d6206eec
diff --git a/CHANGELOG.md b/CHANGELOG.mdindex 1ca2535..455b23e 100644--- a/CHANGELOG.md+++ b/CHANGELOG.md@@ -83,7 +83,7 @@ Format follows [Keep a Changelog](https://keepachangelog.com/en/1.0.0/).- Hold-to-confirm for removing accounts, untracking content and deleting scheduled posts- `/accounts?add=1` opens the add-account flow directly- Location field in bulk publishing (the value was already sent with each post but had no input)-- Frontend unit tests (`cd frontend && npm test`) and backend tests for credential stripping and Instagram publishing parameters+- Frontend unit tests (`npm test` at the repo root) and backend tests for credential stripping and Instagram publishing parameters- `docs/design-reference.md` and `docs/architecture/frontend/DESIGN_SYSTEM.md`**Instagram views by content type**@@ -311,7 +311,7 @@ Format follows [Keep a Changelog](https://keepachangelog.com/en/1.0.0/).### Fixed- Strip non-ASCII characters from `SUPABASE_URL` and `SUPABASE_SERVICE_KEY` env vars in `scripts/publish-scheduled.js` using `/[^\x20-\x7E]/g` to defend against BOM injected by PowerShell 5.1 when setting GitHub Actions secrets-- Replaced embedded literal U+FEFF in BOM-strip regex with proper `` unicode escape+- Replaced embedded literal U+FEFF in BOM-strip regex with proper `\uFEFF` unicode escape---diff --git a/docs/architecture/backend/SERVICES.md b/docs/architecture/backend/SERVICES.mdindex f26f7a7..70cd467 100644--- a/docs/architecture/backend/SERVICES.md+++ b/docs/architecture/backend/SERVICES.md@@ -10,7 +10,7 @@ Pure helpers whose formulas are identical in the Instagram and Reddit analytics:## Instagram (`backend/services/instagram*.js`)-`services/instagram.js` is a barrel that re-exports the public names below, so routes, the scheduler and tests import from it unchanged. Each module imports its siblings directly, never the barrel.+`services/instagram.js` is a barrel that re-exports the public names below, so routes and the scheduler import from it unchanged. Tests in `backend/tests/services/` import the individual modules directly. Each module imports its siblings directly, never the barrel.| Module | Contents ||---|---|diff --git a/docs/architecture/cloudflare/WORKERS.md b/docs/architecture/cloudflare/WORKERS.mdindex 8da4f1e..636f668 100644--- a/docs/architecture/cloudflare/WORKERS.md+++ b/docs/architecture/cloudflare/WORKERS.md@@ -33,7 +33,7 @@ export default {## Environment Bindings (Secrets)-All secrets are set via `wrangler secret put <NAME>`. They are available at runtime as `env.NAME` or `c.env.NAME`.+All secrets are set via `npx wrangler secret put <NAME>`, run from `backend/`. They are available at runtime as `env.NAME` or `c.env.NAME`.| Secret | Required | Purpose ||---|---|---|@@ -53,8 +53,9 @@ All secrets are set via `wrangler secret put <NAME>`. They are available at runt### Setting secrets```bash-wrangler secret put SUPABASE_URL-wrangler secret put SUPABASE_SERVICE_KEY+cd backend+npx wrangler secret put SUPABASE_URL+npx wrangler secret put SUPABASE_SERVICE_KEY# (paste value when prompted - no echo)```@@ -97,7 +98,7 @@ These are hard constraints imposed by the Cloudflare Workers runtime. Violating## Adding a New Worker Secret-1. Set via `wrangler secret put NEW_SECRET_NAME`+1. Set via `npx wrangler secret put NEW_SECRET_NAME` from `backend/`2. Add to `backend/.env.example` with a placeholder value3. Add to `backend/.dev.vars` locally4. Set as a GitHub secret if needed by deploy workflowdiff --git a/docs/features/NEW_INTEGRATION.md b/docs/features/NEW_INTEGRATION.mdindex feb5012..ef0f0ff 100644--- a/docs/features/NEW_INTEGRATION.md+++ b/docs/features/NEW_INTEGRATION.md@@ -213,8 +213,9 @@ await deleteTwitterCache(redis, userId, id);```bash# Add the secrets to the Worker-wrangler secret put TWITTER_CLIENT_ID-wrangler secret put TWITTER_CLIENT_SECRET+cd backend+npx wrangler secret put TWITTER_CLIENT_ID+npx wrangler secret put TWITTER_CLIENT_SECRET```Add corresponding secrets to GitHub Actions if the CI/CD pipeline needs them.@@ -257,5 +258,5 @@ If the platform uses OAuth:- [ ] Access token never returned in any API response (use `safeTwitterAccount()` or equivalent)- [ ] Access token read from `account.accessToken` on the backend - never passed from frontend- [ ] OAuth callback validates HMAC state before accepting code-- [ ] New Worker secrets added with `wrangler secret put` - not stored in `wrangler.toml` plaintext+- [ ] New Worker secrets added with `npx wrangler secret put` - not stored in `wrangler.toml` plaintext- [ ] New secrets added to GitHub Actions repository secrets if needed by CIdiff --git a/docs/workflows/TESTING.md b/docs/workflows/TESTING.mdindex 6df2e35..7e1a1cd 100644--- a/docs/workflows/TESTING.md+++ b/docs/workflows/TESTING.md@@ -170,9 +170,7 @@ If you have a test post scheduled in the near future, use `GET /api/process-sche## Future Test Infrastructure-When automated tests are added, this document will be updated. Priority order for adding tests:+Already in place: golden tests for `computeVideoAnalytics()`, `computeInstagramAnalytics()` and `computeRedditAnalytics()`, and route tests that run the Hono handlers against a fake Supabase client (`backend/tests/fixtures/`). Still to add, in priority order:-1. **Unit tests for `computeVideoAnalytics()` and `computeInstagramAnalytics()`** - pure functions with complex logic, easy to test-2. **Unit tests for `lib/db.js` functions** - using a Supabase test project-3. **Integration tests for backend routes** - using `miniflare` or similar Workers test runner-4. **End-to-end tests** - Playwright for the full login -> view analytics -> publish flow+1. **Tests for `lib/db.js` against a real database** - using a Supabase test project+2. **End-to-end tests** - Playwright for the full login -> view analytics -> publish flowdiff --git a/frontend/src/docs/pages/selfHost/GitHub.jsx b/frontend/src/docs/pages/selfHost/GitHub.jsxindex 2ebb62d..2a7a8ca 100644--- a/frontend/src/docs/pages/selfHost/GitHub.jsx+++ b/frontend/src/docs/pages/selfHost/GitHub.jsx@@ -18,6 +18,7 @@ export default function GitHub() {[<Code>VITE_SUPABASE_ANON_KEY</Code>, 'Same value as in frontend/.env.'],[<Code>VITE_API_URL</Code>, 'Same value as in frontend/.env, ending in /api.'],[<Code>VITE_ADMIN_EMAIL</Code>, 'Optional. Your contact address.'],+ [<Code>VITE_GOOGLE_CLIENT_ID</Code>, 'Optional. Shows Continue with Google on the sign-in page.'],]}/><P>Worker secrets stay in Cloudflare; the backend workflow does not need them.</P>