15 KiB
Handover — Cross Code, all products
Last updated: 2026-11-20. The plan is ROADMAP-v3.md (decided 2026-11-03,
decisions table near the end). This file says where each phase stands and what comes next.
Product-specific notes (where the code lives, known gaps) stay with each product: Cross Events'
are in apps/events/docs/HANDOVER.md, and the Hub's are in
events-hub/docs/ and events-hub/deployment.md.
The docs for every product are here in docs/: the roadmap, the Hub protocol
(hub-protocol.md, with a copy in events-hub), this handover, the plans
for each phase and the rollout checklist (ROLLOUT-1.0.md). The latest
version of everything, and what's deployed, is in VERSIONS.md (update it with
every release).
Repos
| Repo | What |
|---|---|
joshua/crosscode-platform (this one) |
Contracts, the apps (Events from 2.2.0; Accounts, Website and App to come), shared packages, the crosscode script (scripts/), the server agent (apps/agent), and these docs |
joshua/hope-events |
Cross Events up to 2.1.x. Frozen; archived once every install is adopted (EVENTS-2.2-PLAN §7) |
joshua/events-hub |
Cross Code Hub. Its own server, its own scripts/deploy.sh |
joshua/crosscode-site |
crosscode.co.za. Updated at the end of every phase that changes what it says (ROADMAP §9) |
Where each phase stands (ROADMAP §9)
| Phase | What | State |
|---|---|---|
| 0 | contracts 1.0.0 / 1.1.0 | Released 2026-11-04. Not published to a registry (decision 22): the Hub gets a packed release committed to its repo (backend/vendor/) |
| 1 | Hub 2.0.x | Released (v2.0.0 2026-11-05, v2.0.1 AI tokens and v2.0.2 refunds / voiding refunded invoices, 2026-11-17). Not deployed yet: events-hub/deployment.md → "Upgrading to 2.0" (run check-hub2 first). Deploy straight to the latest 2.1.x (below) |
| 1b | Cross Events 2.2.0: moved here as apps/events, the crosscode script |
Released 2026-11-17 (events@2.2.0, with AI use in tokens and the backend under /api). VM tested 2026-11-17 (EVENTS-2.2-PLAN §6, all passing after fixes). Not rolled out: servers still run hope-events v2.1.1 until each install is adopted |
| 1c | Cross Events 2.3.x: authenticator app 2FA (TOTP + recovery codes) | Released 2026-11-17 (events@2.3.0). events@2.3.1 2026-11-18: Next.js 16.4.6 (security advisories for 16.2.0–16.4.4), so roll out 2.3.1, not 2.3.0. crosscode-site v1.3.0 lists it (merged and tagged, not deployed) |
| 1d | Agent 1.0.x + Hub 2.1.x (+ contracts 1.3.0) | Released 2026-11-17 (agent@1.0.0, contracts@1.3.0, Hub v2.1.0). VM tested end to end (AGENT-1.0-PLAN §13: joins, installs behind frp, scheduled / batch / missed updates, uninstall with export and purge, forged and replayed jobs). 2026-11-18: agent@1.0.1 (the agent answers status on the central server itself) and Hub v2.1.1 (adopt passes the church's address; Link takes the short name as a name). Not rolled out: use agent 1.0.1 and Hub 2.1.1 |
| 2 | Cross Events 2.4.0: protocol v2, Linked products, event feed, packages/seo (+ contracts 1.4.0, Hub 2.2.0) |
Released 2026-11-18 (events@2.4.0, contracts@1.4.0, Hub v2.2.0, crosscode-site v1.4.0; EVENTS-2.4-PLAN.md). Before any church gets it: the Events e2e run on Postgres and the VM test (EVENTS-2.4-PLAN §8) |
| 3 | Accounts 1.0.0 (+ contracts 1.5.0, agent 1.1.0, Hub 2.3.0) | Released 2026-11-18 (accounts@1.0.0, contracts@1.5.0, agent@1.1.0, Hub v2.3.0, crosscode-site v1.5.0; ACCOUNTS-1.0-PLAN.md). 37 backend and 8 Playwright tests pass without Postgres. Before installing it for a church: the VM test and a run on real Postgres; a Hub release source for accounts@ tags |
| 4 | Cross Events 3.0.0: sign-in through Accounts, users migrated with their password hashes and 2FA | Released 2026-11-19 (events@3.0.0, accounts@1.1.0, contracts@1.8.0, Hub v2.5.0, crosscode-site v1.6.0; EVENTS-3.0-PLAN.md). Tested on Postgres 18: both migrations, test:accounts on real databases (14/14), the Events e2e suite (111, incl. sign-in-accounts.spec.ts). Not VM tested yet. Roll out: Hub 2.5.0 deployed first, then per church Accounts 1.1.0 → Events 3.0 → Move (MIGRATING-TO-3.md); crosscode-site 1.6.0 once the first church has moved |
| 4+ | Running it: jobs from the dashboard, styled Accounts emails, .env from the Hub, sign-in health, the nightly people check | Released 2026-11-20 (see below). Unit, bats and full npm run check passing; not VM tested, not deployed |
| 5–7 | Website 1.0.0 → App 1.0.0 → App 1.x | Not started |
Released 2026-11-20
All tagged and pushed; nothing deployed yet. Details in CHANGELOG.md, the apps' CHANGELOGs and What's New, and VERSIONS.md.
| Release | What |
|---|---|
events@3.4.0, accounts@1.4.0, contracts@1.12.0, agent@1.3.0, Hub v2.8.0 |
Background jobs switched on/off and rescheduled from each site's admin (saved in job_overrides, wins over the .env, applies at once; Accounts gets an Admin → Background jobs page). Accounts' emails styled as Events' (src/lib/emails.ts). The Hub reads and changes an install's .env (env-read / env-set jobs → crosscode env; secrets never leave the server; the file is put back if the site doesn't start; the frontend's file triggers a rebuild) |
events@3.5.0, contracts@1.13.0, agent@1.3.1, Hub v2.9.0 |
Fix: "Load demo data" deleted the Accounts link (set-demo.js truncated ProductLink), so events-demo couldn't sign anyone in (ACCOUNTS_UNAVAILABLE). Demo data keeps the link; a site in Accounts mode without a link reconnects at its next heartbeat. Heartbeat stats.signIn; Hub alerts: not linked (critical), wrong Accounts, sign-in failing, an Accounts nothing links to. Agent 1.3.0 reported itself as 1.2.0: use 1.3.1 |
accounts@1.6.0 |
A "New sign-in" email (and WhatsApp) after every sign-in; Sign-in settings → signin_notices turns it off |
events@3.6.1 |
Fix: logo/favicon uploads failed on events-demo ("uploaded, but the site can't show it yet"). FastPanel's static-file rule sent every /api/… path with a file extension (.png, .pdf, …) to the frontend. The site now passes /api/* and /uploads/* on to the backend (BACKEND_INTERNAL_URL); the installers' nginx uses location ^~. Change each FastPanel site too (below) |
events@3.6.0, accounts@1.5.0, contracts@1.14.0 |
The nightly people check (accounts-people-check, 04:30): people.check 500 subs at a time; fixes out-of-date copies, handles deleted accounts as user.deleted, stops (changing nothing) when most people are unknown. Skipped with an Accounts before 1.5.0 |
To fix events-demo before it's updated: its Settings → Linked products → Connect the church's Accounts (or update it to Events 3.5.0+, which reconnects within ~15 minutes).
FastPanel sites (central server)
FastPanel's nginx on the central server is the only router for sites behind frp: the church
server has no nginx. Its static-file handling adds a regex location for file extensions
(png|jpg|ico|svg|css|js|pdf|txt|…) that falls back to the site's main proxy, the frontend. A
plain location /api loses to it, so /api/uploads/…/logo.png reached Next.js and got a 404
(fixed in the site by Events 3.6.1, but slower and without the visitor's IP). In each Events
site's nginx config in FastPanel, the backend locations must be ^~ (a prefix match that no
regex can override):
location ^~ /api/ {
proxy_pass http://127.0.0.1:<api port>;
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Forwarded-Proto https;
}
location = /api { proxy_pass http://127.0.0.1:<api port>; }
The Hub's FastPanel email (AGENT-1.0-PLAN §11) still says just "/api → backend": it should say
location ^~ /api/. Check after a change:
curl -sI https://<domain>/api/health.png must say X-Powered-By: Express (a 404 is fine).
Next up
Nothing from phase 1 onwards is rolled out yet (VERSIONS.md, "Deployed / rolled out"), so roll out straight to the latest releases rather than each one in turn.
- VM test the latest releases before any church gets them (the 2026-11-17 VM test covered Events 2.2 and agent 1.0; Events 2.4+, Accounts and Events 3.x haven't been on it): Events 3.x with Accounts and the move (MIGRATING-TO-3.md), the event feed and Linked products (EVENTS-2.4-PLAN §8), and today's: the Hub's .env panel (read; a backend URL with restart; a frontend value with rebuild; a value that stops the site, so it's put back), the job switches, a demo load (the Accounts link stays) and the people check. Also the Events e2e suite on Postgres.
- Roll out, in the order in ROLLOUT-1.0.md, with the latest releases:
Hub 2.9.0 (make and back up the job-signing key first; 2.4.0 onwards have migrations) → the
central server's agent (check
proxy_bind_addr = 127.0.0.1) → each church server's agent (1.3.1, never 1.3.0) → adopt the demo site, then each church (Link existing → Move onto the monorepo) → per church Accounts 1.5.0 before Events 3.6.0, then the move to Accounts (MIGRATING-TO-3.md) → a throwaway New install to prove FASTPANEL, DNS and Let's Encrypt. - Deploy crosscode-site.
v1.3.0–v1.5.0are tagged but not recorded as deployed;v1.6.0(one sign-in through Accounts) once the first church has moved. - Archive
hope-eventsonce every install reports 2.2.0 or later (EVENTS-2.2-PLAN §7).
The VM test (2026-11-17)
Everything above was run on a WSL Ubuntu 24.04 VM before release: a church server, a "central"
network namespace running frps with proxy_bind_addr, the Hub (feat/servers-agent) and local
git mirrors standing in for c-git. It found nine bugs, all fixed with tests before tagging. None
lost data, because each failed safely:
adoptrefused a release with new migrations (it now applies them in the switch-over).- A failed migration blocked every later deploy (Prisma P3009; now marked rolled back).
- The agent install skipped the root's build tools (
npm ci --include-workspace-root). - A failed install's short name couldn't be used again.
- The Hub didn't save the servers settings (install defaults, port range, central IP).
- frpc only reads its admin lines when it starts (restarted once the first time).
- A site's PM2 belonged to the agent's service, so stopping or updating the agent took down
every site it had installed. PM2 now always runs under
pm2-<user>. - Update and closing banners never reached Hub-installed sites (registration now links them).
- A moved tag blocked a church's deploys (tags are fetched with
--force).
Not covered by the VM: FASTPANEL, real DNS, Let's Encrypt. Hence the throwaway install in the rollout.
Things to remember across phases
- Before selling the Website or App: put the ROADMAP §10 prices in
crosscode-site/src/data/pricing.mjsand the Hub'sfrontend/src/lib/tiers.ts(plusbackend/src/utils/billing/tiers.js) in the same phase, so the site and the Hub never disagree. - A phase isn't done until crosscode-site matches it (ROADMAP §9, "Updating crosscode-site").
- Servers stay PM2 + nginx (no Docker), with one database per product per church, under
/var/www/sites/<church>/<product>. Each site user's PM2 runs as a systemd unit,pm2-<user>; thecrosscodescript makes sure of it before any PM2 command. - The agent pins the Hub's job key when it joins. Back up
events-hub/backend/keys/(licence and job keys); replacing the job key means every server joins again. - A new
.envvariable goes in three env templates:apps/<product>/env.template.json,scripts/products/<product>.env.template.jsonand the Hub'senvTemplates/<product>.json. If the app refuses some values at startup (as Events does aTRUST_PROXYit can't parse), add a rule to bothcheckEnvValueinpackages/contracts/src/agent.ts(the Hub) andVALUE_RULESinscripts/lib/envtpl.cjs(the server), so a bad value stops before an install's build. - Demo data: Hub → the install's page → Mark as a demo site → Load demo data (Hub 2.4.0, agent
1.2.0;
crosscode demo <church> --profile …on the server). By hand, runnpm run demo:*as the site's user (sudo -u cc-<church> …): only that user can read the.env. - A new Events install never takes over an existing database: moving an existing site is
adopt, not a New install pointed at the old database. - Prisma in the monorepo: each app other than Events sets its own generator
output, so hoisted clients don't overwrite each other (EVENTS-2.2-PLAN §2). - AI for a church: set the licence's monthly AI cap above R0 on the Hub; with no cap the buttons don't show (rules in Events' handover, "AI rules"). Churches see tokens; only the Hub shows rand (markup 15% by default).
- The agent's version is in two places:
apps/agent/package.jsonandAGENT_VERSIONinapps/agent/src/stats.ts(what it reports to the Hub). Bump both; the agent's test checks they match, so runnpm run checkafter the bump (1.3.0 shipped reporting 1.2.0). - Background jobs: each job's switch and schedule can be set in the site's admin (Events and
Accounts, AppSetting
job_overrides); that wins over the .env flag andJOB_SCHEDULE_<NAME>.JOBS_ENABLED=falsestill turns everything off. A new job gets alabeland, if it may be turned off from the .env, anenvflag. - An install's .env from the Hub (install page → Settings (.env), agent 1.3.0+): plain values
only. Names matching
SECRET_ENV_NAME(contracts) /SECRET_NAME(scripts/lib/envedit.cjs; keep them in step) and generated values can't be read or changed from the Hub. Changing an address there doesn't change the Hub's domain for the install or FastPanel. - Demo data keeps the links to the church's other products (
KEEP_TABLESinapps/events/backend/scripts/set-demo.js). Anything that must survive a demo load goes there. - Releasing: branch → merge → tag (
<product>@<version>here,v<version>in events-hub and crosscode-site) → push, with a CHANGELOG entry, andnpm run checkfirst. Pushes to c-git often fail authentication the first time; retry once. A push can also hang waiting on a login prompt after it has already gone through: check withgit ls-remotebefore pushing again.