Files
crosscode-platform/apps/app/README.md
T
joshuaandClaude Opus 5.5 71f2f02ee5 crosscode: the Church App (app.sh, add, demo) and the App's changelog
scripts/products/app.sh and app.env.template.json; app in
SUPPORTED_PRODUCTS; crosscode add <church> app (Accounts first);
crosscode demo <church> app --profile <s>, and the App's turn, last,
in a whole demo scenario. app.bats and demo.bats; app.sh linted.
The full bats suite wasn't run (stopped for low memory); app.bats and
demo.bats pass.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-12-01 16:11:41 +02:00

73 lines
5.6 KiB
Markdown

# Church App
The church-branded web app (PWA) for its members, with the **House of Prayer** as its headline
(ROADMAP-v3 §7, phase 6; plan and decisions in [docs/APP-1.0-PLAN.md](../../docs/APP-1.0-PLAN.md)).
Served at `app.<church's address>` (or `<church>.crosscode.co.za`), added to the home screen, with no
app-store release. Anyone can browse its public content; booking a prayer slot, a prayer request
and notification settings need a sign-in through the church's Accounts. The admin is at `/admin`.
**State:** being built (from 2026-12-01) on the branch `feat/app-scaffold`, which is merged into
main only when `app@1.0.0` is done (main keeps a placeholder until then). Not released;
`app@1.0.0` is tagged when the plan is built. Done so far (plan §1–§12: the foundation, the House of Prayer, prayer requests, announcements,
devotionals and events, email and WhatsApp, the admin, and the demo scenarios):
- **Backend:** Express + Prisma + pg-boss (ES modules, as the Website). Registers with the Hub
(`CCP-` licence key, product `app`) and sends the heartbeat with the active-member band the App
tier is billed on; links itself to the church's Accounts once the Hub lists it; the church
profile from Accounts (colours made safe, font pairing, corners).
- **Signing in** (`backend/src/auth/`): anyone with an account at the church's Accounts becomes a
Member. A sign-in lasts 8 days, renewed by each visit, up to 90 days (decision 7). Roles (Owner,
Church admin, Content admin, Devotional writer, Prayer coordinator, Pastoral care) are the App's
own; every one needs a sign-in with 2FA to use what it adds. The first Owner is whoever signs in
with the Hub's admin email (`HUB_ADMIN_EMAIL`), verified in Accounts. Accounts' `user.updated`
(WhatsApp STOP included), `user.export` and `user.deleted` are handled.
- **Active members:** the last day a member used the App signed in, written at most once a day (in
the church's timezone); the heartbeat reports only the band.
- **Modules:** House of Prayer, Prayer requests, Announcements, Devotionals and Events can each be
switched off (`PUT /api/v1/admin/modules`); Home and the tab bar only show what's on.
- **Frontend:** Next.js 16, mobile first: the header, the bottom tab bar (Home, Prayer, Events,
Devotional, Me), the church's colours, fonts and footer; the manifest and icons from the profile
(its icon, else its initials on its colour; a maskable one too); the service worker (offline
shell, pages kept for offline, a signed-in member's pages forgotten once they're signed out, no
push); "Add to home screen" (Android's prompt, the iPhone's steps); Me; the admin's first
dashboard. The modules' screens say what's coming.
- **House of Prayer** (§3, `backend/src/prayer/`): the 24-hour clock, live; booking once, weekly or
daily with reminders; skip, change, stop within the 8-hour rule; the renew and "I prayed" links;
campaigns and moderated testimonies; the admin's week, names (access-logged), rules and campaigns.
Reminders and renewal notices go by email or WhatsApp (§8).
- **Prayer requests** (§4, `backend/src/requests/`): private to the prayer team by default, or
shared with members after approval; redact, don't share, reply, escalate to Pastoral care; "I
prayed" counts; closing after 30 days, deleted a year later; every view of a sender access-logged.
- **Announcements, devotionals and events** (§5–§7, `backend/src/content/`, `backend/src/events/`):
announcements for everyone or members; Cross Code's devotionals from the Hub each night (the next
2 weeks) or the church's own with the CSV import, KJV and BSB only, Read in YouVersion; simple
events and the event feed both ways; Article and Event JSON-LD and a sitemap for the public pages.
- **Email and WhatsApp** (§8, `backend/src/messaging/`): the church's one set of settings from
Accounts (`messaging.get`, refreshed on `messaging.changed`), the outbox sent every minute with STOP
checked before every WhatsApp, announcements and the day's devotional queued for those who asked,
Me → What the App sends me, and the admin's Email and WhatsApp page with Send a test.
- **The admin** (§10, `backend/src/admin/`): the side menu, the setup checklist, members and roles,
settings, background jobs, audit and access logs, Share the App with a QR poster; uploaded images
(`backend/src/media/`); backups of the database and the images (`backend/src/backups/`); the
church export's `app` part (`backend/scripts/export-church.ts`).
- **Demo scenarios** (§12, `backend/src/demo/`): `npm run demo` loads Acacia Hill; `npm run demo --
--profile <scenario>` any of the eight demo churches (`--list`), around the same people as
Accounts. On a server: `crosscode demo <church> app --profile <s>`, or the whole scenario with
`crosscode demo <church> --scenario <s>` (`scripts/products/app.sh`; `crosscode add <church> app`).
The demo devotionals' Bible text comes only from `backend/scripts/demo-passages.ts`, which copies
it from the public-domain KJV and BSB files (not in the repo): never type or edit it.
**Still to come** (plan §14–§15): e2e, axe and Lighthouse.
- `backend/`: `npm run dev`, `npm test` (Node's test runner through tsx), `npm run build`. The
schema is in `prisma/schema.prisma`.
- `frontend/`: `npm run dev` (port 3400, sends /api to the backend on 5400).
Local development: Postgres in `backend/.env` (`DATABASE_URL`, `APP_URL=http://localhost:3400`),
`npx prisma migrate deploy`, then `npm run dev` in both folders. Set `LINKS_ALLOW_PRIVATE=true` to
link to an Accounts on http://localhost. The service worker only runs in a production build
(`npm run build && npm start`).