Release 2.0.0: Cross Code Hub
Docs: protocol v2 (hub-protocol.md §6), README, deployment.md (Upgrading to 2.0), plan marked done, CHANGELOG 2.0.0; versions 2.0.0. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
@@ -1,16 +1,26 @@
|
||||
# Cross Events Hub
|
||||
# Cross Code Hub
|
||||
|
||||
Joshua's central management app for every **Cross Events** install: customers, licences,
|
||||
install health and usage, and alerts. Customers never log in here.
|
||||
Joshua's central management app for every Cross Code product a church has — **Cross Events**,
|
||||
**Accounts**, the **Church Website** and the **Church App**: customers, a licence per product,
|
||||
releases per product, install health and usage, AI, billing and alerts. Customers never log in here.
|
||||
(Until 2.0 this was the Cross Events Hub; the plan for 2.0 is `docs/HUB-2.0-PLAN.md`, and the
|
||||
roadmap is `hope-events/docs/ROADMAP-v3.md`.)
|
||||
|
||||
> **Naming:** Cross Events was called **Hope Events** until October 2026. Older commits, the
|
||||
> `hope-events` repo name and the `hel1.` licence-token prefix still use the old name. The
|
||||
> prefix is part of the protocol, so it stays.
|
||||
> `events-hub` repo name, the `CEH-` licence-key prefix and the `hel1.` licence-token prefix still
|
||||
> use the old names. The prefixes are part of the protocol, so they stay.
|
||||
|
||||
- `backend/` — Express + Prisma (Postgres) API, port 5200
|
||||
- `frontend/` — Next.js dashboard, port 3200
|
||||
- `docs/hub-protocol.md` — the contract with Cross Events installs (a copy lives in the
|
||||
`hope-events` repo; change both together)
|
||||
- `docs/hub-protocol.md` — the contract with installs, protocol 1 (Cross Events 2.1) and 2 (every
|
||||
product); a copy lives in the `hope-events` repo, and the v2 formats are in `@crosscode/contracts`
|
||||
- `backend/vendor/crosscode-contracts-<version>.tgz` — the shared formats, committed so deploys
|
||||
need no package registry. To update: `npm pack` in `crosscode-platform/packages/contracts` at its
|
||||
new tag, put the file here, `npm install --save file:vendor/<file>` in `backend`, remove the old file
|
||||
|
||||
**Products** (Hub 2.0): every licence and install is for one product. A church has at most one
|
||||
licence per product that isn't revoked; generating its first product licence also makes its free
|
||||
Accounts licence. Keys: `CEH-` Events, `CCA-` Accounts, `CCW-` Website, `CCP-` App.
|
||||
|
||||
Installs only ever call the Hub (register, heartbeat); the Hub never reaches into an install
|
||||
and holds no church data — just versions, health and aggregate counts.
|
||||
@@ -41,28 +51,34 @@ and `HUB_PUBLIC_KEY` (the public key shown in Hub → Settings) in Cross Events'
|
||||
|
||||
## Releases and notices
|
||||
|
||||
- **Releases** come from git: every `v1.2.3` tag of `joshua/hope-events` is a release, the newest is
|
||||
the latest version, and the notes churches see come from `WHATS-NEW.md` on that repo's default branch (only for
|
||||
tagged versions, so notes can be written ahead or corrected later). The Hub checks every 15 minutes (and on **Sync now**, Releases page). So releasing
|
||||
Cross Events is: write the version's section in `WHATS-NEW.md`, tag, push — installs see the
|
||||
update with their next heartbeat.
|
||||
- **Releases** come from git, per product (Releases page → Release sources): each source is a
|
||||
repository, a tag prefix and a notes file. By default every product comes from
|
||||
`joshua/crosscode-platform` (`events@1.2.3`, `accounts@…`, `website@…`, `app@…`, notes in
|
||||
`apps/<product>/WHATS-NEW.md`), and Cross Events before the move also from `joshua/hope-events`
|
||||
(`v1.2.3`, `WHATS-NEW.md`). A product's newest tag is its latest version; notes show for tagged
|
||||
versions only (so they can be written ahead or corrected later). A heading like
|
||||
`## 3.0.0 — requires accounts 1.2.0` makes Request update wait until the church's Accounts is new
|
||||
enough. The Hub checks every 15 minutes (and on **Sync now**); an unreachable source never removes
|
||||
releases. So releasing is: write the version's section in the notes file, tag, push — that
|
||||
product's installs see the update with their next heartbeat.
|
||||
- **Notices** (Notices page) are banners on churches' sites for their admins and supervisors, emails
|
||||
to them, or both — e.g. planned maintenance.
|
||||
|
||||
## AI (Cross Events 2.0)
|
||||
## AI
|
||||
|
||||
Sites call AI through the Hub (protocol §3b), so the Claude API key never leaves this server.
|
||||
Set it up in **Settings → AI**: the key, the model (Claude Sonnet 5.5 by default; choosing one from the
|
||||
list fills in its prices, kept in `backend/src/utils/aiModels.js` — update that list in a release when
|
||||
Anthropic's prices change), the exchange rate and the default markup — AI stays off for every site
|
||||
until the key and exchange rate are saved;
|
||||
**Test the saved key** checks them. Each licence has a monthly **AI cap** in rand (0 = off) and an
|
||||
optional markup override, on the customer's page. The cap counts what the church is charged
|
||||
(real cost plus markup); the Hub checks the worst case before every call, so a month can't run over.
|
||||
**Test the saved key** checks them. Each church has a monthly **AI cap** in rand (0 = off) and an
|
||||
optional markup override, on the customer's page, shared by all its sites (Hub 2.0). The cap counts
|
||||
what the church is charged (real cost plus markup); the Hub checks the worst case before every call,
|
||||
so a month can't run over.
|
||||
Use per site (real cost, charged, profit) is on Settings → AI and on each install's page. No prompt
|
||||
or response text is stored.
|
||||
|
||||
## Billing (1.7.0)
|
||||
## Billing
|
||||
|
||||
Invoices, receipts, statements and notices of licence change, each emailed (styled HTML) with a PDF.
|
||||
The code is in `backend/src/utils/billing/` (`compute.js` the rules, `pdf.js` the documents, `email.js`
|
||||
@@ -117,7 +133,9 @@ installs check licences with the public key, which is built into Cross Events
|
||||
|
||||
## Deploying
|
||||
|
||||
Same pattern as Cross Events: on the server (`events-hub.crosscode.co.za`), behind nginx with
|
||||
See `deployment.md` (and its "Upgrading to 2.0" before deploying 2.0 the first time). In short: the
|
||||
same pattern as Cross Events: on the server (`events-hub.crosscode.co.za`, with `hub.crosscode.co.za`
|
||||
as the new address), behind nginx with
|
||||
HTTPS, two PM2 processes (`backend`: `npm start`; `frontend`: `npm run build && npm start`),
|
||||
`TRUST_PROXY=1`, `FRONTEND_URL=https://events-hub.crosscode.co.za`, and the frontend's
|
||||
`NEXT_PUBLIC_API_URL` set to the public API address (e.g. `https://events-hub.crosscode.co.za`
|
||||
@@ -126,4 +144,7 @@ with nginx routing `/api` to port 5200). Back up the database daily, plus the si
|
||||
## Tests
|
||||
|
||||
`cd backend && npm test` — encryption, licence tokens, request signatures, two-factor codes
|
||||
(RFC 6238 vector) and alert rules.
|
||||
(RFC 6238 vector), alert rules, products and licences, protocol v1 and v2 (every contract sample
|
||||
through the routes), releases per product and requirements, billing (prices, bundles, add-ons,
|
||||
prorating, the address, monthly recurring revenue) and AI. `cd frontend && npx eslint src` and
|
||||
`npx tsc --noEmit` check the dashboard.
|
||||
|
||||
Reference in New Issue
Block a user