Slot materialization (ARCHITECTURE §5.2): for each non-published instance, plan the seats planSlots() computes and upsert them on (service_instance_id, role_id, slot_index). onConflictDoNothing makes it idempotent; published weeks are skipped (owned by the publish flow). - src/domain/slots.ts: pure planSlots()/planSlotsForRole(); headcount fills slotIndex 1..N, call_time = start + offset (null if no offset). - src/domain/slots.test.ts: 5 tests (Audio headcount 2 -> 2 slots with correct call_time, clamp to 1, null offset, multi-role flatten). - src/db/slots.ts: materializeSlotsForInstance() + materializeSlots(). - src/app/api/dev/cron/slots/route.ts: GET drives the daily job. No schema change (slots unique index predates this unit; position_skills stays deferred to D5). Verified: draft instance + Audio headcount 2 -> 4 seats (Audio x2 + Livestream + Slides), Audio call_time 09:30 EST; re-run creates 0 rows. Seed restored to canonical 4 instances / 12 slots after testing.
Media Team Hub — Planning Docs
Architecture and build documentation for a church media team scheduling and training platform. No application code yet — these are the documents you review, approve, and hand to whoever builds it.
Read in this order
| Doc | What it answers | Length |
|---|---|---|
| docs/FEATURE-SUMMARY.md | Plain-language feature list with a tick-box sign-off — send this to the ministry leader. | ~5 min |
| docs/BUILD-SPEC.md | What are we building, screen by screen, and in what order? The build team's source of truth. | ~15 min |
| docs/ARCHITECTURE.md | How is it built — stack, data model, scheduling and reminder logic, security. | ~25 min |
| docs/BUILD-PLAN.md | The order to build it in: 56 units across 10 phases (plus 5 deferred media-library units), 7 checkpoints, and the rules that stop an AI agent looping. Give this to the agent. | ~15 min |
The 60-second version
The problem. Three roles — Audio, Livestream, Slides — every week, managed by memory and group texts.
The product. One place where:
- volunteers publish blackout dates and confirm shifts in three taps from a text message;
- each person records how comfortable they are on each piece of gear, an admin or mentor verifies their real level, and experts become mentors for people who want to learn that position;
- an admin approves people and builds the week on a drag-and-drop grid with conflict detection and fair auto-fill;
- the system emails each volunteer the Friday before they serve, with the call time (SMS reminders are deferred to a later phase — see launch scope note below);
- one-off events — weddings, baptisms, youth nights — get a photographer assigned on the same engine, with a shot brief on their phone; a RAW photo library for editors is designed but deferred to phase 2;
- training lives alongside it — rich text how-tos and videos, gating who is qualified for which role;
- anything on screen comes out as a file: PDF for the printed booth sheet and leadership packs, XLSX for working spreadsheets, CSV for everything else.
The stack. Next.js + TypeScript on Cloudflare Workers, SQL via Drizzle (D1 or Postgres), Postmark for email, R2 for media, TipTap for rich text everywhere, cron worker for reminders. SMS (Twilio) is deferred — launch is email-only.
The cost. About $35–40/month at ~120 volunteers.
The timeline. ~10.5 weeks full-time, ~6 months part-time, with a 4-week pilot on one service before retiring the spreadsheet.
Launch scope (decided): email-only. SMS reminders (Twilio + A2P 10DLC registration) are deferred to a later phase. The notification pipeline is built channel-agnostic, so SMS slots in later with no rework. When you're ready: a Twilio EIN + 10DLC brand registration (1–3 weeks) is the only external lead time.
Design decisions worth arguing about
- "Friday before" is a rule row, not code. Reminders are computed as
service start − 2 days at 18:00 local, so a Wednesday service automatically reminds on Monday and the church can move the send time without a developer. - Volunteer responses never require a login. Signed one-click links in the email and text carry the confirm/decline action. Any friction at that moment kills the whole system's value.
- The schedule does not depend on AI or on a third-party service. Publishing writes to an outbox table; a cron worker drains it. An email outage cannot block scheduling, and an LLM outage hides one search box.
- Auto-fill is deterministic scoring, not a model. Fairness, certification and availability are solved in ~60 lines of ranked logic that an admin can read and explain.
- Draft vs published weeks. Nothing notifies anyone until the admin explicitly publishes, which prevents the schedule-storm that kills trust in tools like this.
- Certification gating. A trainee cannot be dropped alone on the audio board; shadow slots are a first-class concept.
- Nothing about the gear is hardcoded. Categories, companies, products, functions, positions and the skills composed from them are all admin-edited rows. Buy a new switcher or rename a position and the app follows — no deploy.
- Skill is per technology, not per person. Someone can be 90% on ProPresenter and 30% on the audio console, so scheduling asks "who can run this position this Sunday" — availability first, then verified competency, then fairness. Self-rated comfort informs the decision; only a mentor's sign-off authorises it.
Before you build: 5 answers needed
- Exact service times and timezone.
- One person per role, or more on big Sundays?
- Who is an admin vs. a coordinator, and what does each own?
- What system are you migrating from (CSV export available)?
- Email: a domain you control for the sending address (e.g. media@yourchurch.org) plus SPF/DKIM/DMARC. SMS is deferred — when you add it you'll need a Twilio EIN + 10DLC registration (1–3 weeks), but that can wait until email is running.
Full list in BUILD-SPEC.md §12.
Decisions recorded from your answers
These are the concrete answers to the five pre-build questions, recorded so the builder doesn't re-ask them:
- Services: two Sunday services — 10:30 AM and 5:30 PM, timezone America/New_York (not a fixed "EST" — the system stores UTC and renders local, so DST is handled automatically). Both are fully changeable later as data, no code.
- Headcount: one person per role for every slot.
- Roles: Admin = full control over everything, including system/settings. Coordinator = full control over scheduling, people, events, training and notifications — everything except design/theme and admin/system settings (i.e. a feature-scoped split, not a single-role scope).
- Migration: CSV only — a one-way "load existing volunteers" step, not a two-way sync.
- Notifications: email-only at launch; SMS (Twilio + 10DLC) deferred to a later phase.
Suggested next step
Review the build spec, answer the five questions, then start Phase 0: wireframes for the schedule grid, approval queue, blackout calendar and lesson editor — and kick off the Twilio 10DLC registration in parallel, since it has the longest external lead time.
Documents dated 2026-11-17. Prices and provider fees are estimates — verify current pricing before committing a budget.