Stack
What an SVRBC site is built with. Hosting covers where it runs, and Sites the conventions every site follows whatever it’s built with. Decided 2026-10-07; existing sites move when someone next works on them.
Pick the lowest tier that works
Section titled “Pick the lowest tier that works”| Tier | When | Front end | Back end | Hosted on |
|---|---|---|---|---|
| 1. Static (the default) | Every page is the same for everyone until the next release | Astro, static output | none | S3 and CloudFront; GitLab Pages if it’s for developers |
| 2. Static, with an API | Some data changes between releases, or something must hold a secret (a form, a payment, seats left) | Astro, static output | one Rust function on Lambda, at /api/* |
AWS: S3, CloudFront, Lambda |
| 3. Server-rendered | A page’s HTML depends on who asks (signed-in views, per-user pages) | Astro, rendering on the server | the site’s own endpoints and actions | AWS: S3, CloudFront, Lambda |
A site moves up a tier only for a reason its AGENTS.md gives. Most
SVRBC sites are tier 1: a page changes when someone changes it, so it can be
built once, at release, rather than on every request.
SVRBC’s code is now mostly written by AI agents. That changes what a framework is for: saving a person typing matters less than how little the framework does implicitly and how much the build checks.
- Explicit beats convenient. Nuxt’s auto-imports, file conventions and
server/client split are where an agent writes plausible code that is
wrong. An Astro file says what it imports; the code at its top runs at
build time, and the template below it is the output.
astro checkand the build catch most of the rest. - No JavaScript unless a part needs it. Astro ships plain HTML and CSS, and loads a script only for an island that asks for one. Nuxt hydrates the whole page, interactive or not. Short of writing the HTML by hand, nothing serves faster.
- One framework at every tier. A site that grows from tier 1 to tier 3 changes how some of its pages are rendered, not what it’s written in, and agents work in one set of conventions across every SVRBC site.
- No server to run. A static site has none of the
Lambda traps: no writable
/tmpto arrange, no server routes to keep apart from static paths, no function to deploy. Astro’s content collections do at build time what Nuxt Content does on the server. - Rust for APIs because the compiler is the strictest reviewer an agent has: a handler either type-checks against the real shapes of its data or doesn’t build. It also starts fastest on Lambda (tens of milliseconds cold) and needs the least memory, which is what Lambda bills.
Front end: Astro
Section titled “Front end: Astro”output: 'static'(Astro’s default), with no adapter, at tiers 1 and 2. Only tier 3 adds one.- Content is Markdown in the repository, in content collections, read at build time. A change to it is a commit, and goes live with a release. Data that changes between releases comes from the site’s API, fetched by an island.
- Native HTML before a component library. Agents write components
directly, so a library mostly saves typing nobody does.
<dialog>,<details>, thepopoverattribute and native form validation cover most of what one was for, accessibly. Pull in a library only for a widget that is hard to get right (a combobox, a date picker), inside an island. - Styling with Tailwind CSS, through its Vite plugin. Name colors for
what they're for (
bg-default,text-muted,text-primary), as tokens in the site's stylesheet that follow the visitor's light or dark setting, rather than writing palette colors through the markup. - A site’s palette comes from one color, its logo’s. The neutrals (the
page, text, muted text and lines, in both themes) take that color’s hue at
a low chroma, so a blue site has cool grays and a terracotta one warm
ones, rather than a blue link on a beige page; a black or gray color gets
plain grays. Links are the color itself, darkened in the light theme or
lightened in the dark one until they read at 4.5:1 or better (WCAG AA) on
the page.
svrbc-new-siteworks it out in OKLCH, where lightness is what the eye sees, so every site’s grays sit at the same lightness whatever their hue; the template’s colors are what it gives for the template’s own color. - Scroll bars are always custom, styled by the site, never the
browser’s default. The default bar is drawn in the system’s colors, not the
site’s, and is the one part of the page its design doesn’t reach: a grey
bar against the palette, or a light one down a dark page. Set
scrollbar-color(the thumb, then the track) from the site’s color tokens, so the bar follows light and dark as the rest of the page does, andscrollbar-width: thin, on every element (*):scrollbar-widthisn’t inherited, and a box that scrolls (a wide table, a code block, a dialog) gets the same bar as the page. Browsers withoutscrollbar-colorget::-webkit-scrollbarrules inside@supports not (scrollbar-color: auto). The template’sglobal.cssdoes all of this; a Starlight site does it in itscustomCss, from Starlight’s grays. - Icons with unplugin-icons,
compiled as Solid components (
compiler: 'solid'), so one import works in.astrofiles and islands alike:import Ticket from '~icons/lucide/ticket', then<Ticket class="size-5" />. In an.astrofile it renders as plain SVG at build time and ships no script. Install only the sets used (@iconify-json/lucide,@iconify-json/simple-icons); only the icons imported reach the page. Addunplugin-icons/types/solidtotypesintsconfig.json, andastro checktakes the icons’ props as they are. - Fonts self-hosted with Fontsource, imported in the stylesheet, so no page asks Google for anything. Import the weights the design uses; a variable font draws heavier than the static weights a design was made with.
- A component that takes a
classmerges it with its own using tailwind-merge, so the one passed in wins (justify-startover the component'sjustify-center). Only in.astrofiles, where it runs at build time: in an island, write the classes already merged, and keep it out of the browser. - A documentation site uses Starlight, Astro’s documentation theme.
astro checkruns in the build step, beforeastro build, so a type error fails the pipeline rather than the page.- A type-aware lint runs as
//:lint_test(Checks), for the mistakes that type-check and build and are still wrong.
Islands: Solid
Section titled “Islands: Solid”An island is a component that runs in the browser. Write islands in
Solid, through @astrojs/solid-js, as .tsx
files with "jsxImportSource": "solid-js" in tsconfig.json. Its components
are TSX, so TypeScript and astro check read an island’s props as they read
everything else, and it is written in the same JSX-like syntax as the
.astro file around it. It updates the DOM where a signal changes, with no
virtual DOM, and its runtime is small. Load an island as late as works: client:visible or client:idle before client:load.
Solid looks like React and isn’t, and agents write React in it. A project
with islands says in its AGENTS.md that a component runs once: what
changes is a signal, read by calling it (count()) where it’s used.
Not everything that runs in the browser is an island. A few lines that set
an attribute or a class (a menu’s toggle, a badge kept current) are a
<script> in the component; an island is for something that holds state.
- Never destructure props.
function Price({ amount })readsamountonce and never again;props.amountfollows it. UsesplitPropsto pass some of them on andmergePropsfor defaults. <Show>and<For>, not&&and.map():.map()rebuilds every row whenever the list changes.classandclassList={{ open: open() }}, notclassName.- State several islands share goes in a module that each island
imports, holding signals (
createSignal) or a store (createStore) for nested data. Islands on one page share one copy of a module, so one object serves them all. A store wraps everything in it in proxies; a large object that is replaced whole, not changed in place, belongs in a signal. - Browser-only APIs go in
onMount, not the component’s body. Astro renders every island to HTML at build time first, where there is nowindow, andlocalStoragein the body fails the build withReferenceError: localStorage is not defined. - A line break between text and a tag disappears, as in an
.astrofile (below): JSX treats whitespace the same way.
Things Astro does that bite
Section titled “Things Astro does that bite”- A line break between text and a tag disappears. Astro treats the
whitespace the way JSX does:
pastat the end of a line and<BrandMark />starting the next render aspast#doreancon. Keep the text and the tag on one line, or write{' '}. svrbc.org’stest/astro-whitespace.test.tsfinds both shapes of it (text, then a line starting with a tag; an inline element closed at the end of a line, then text) in every.astrofile; copy it. {count && <p>…</p>}renders0whencountis 0. Write{!!count && …}or a ternary.- A content collection drops what its schema doesn’t name, without a
word. A field added to the YAML but not the schema never reaches the page,
and a site moved from Nuxt Content (which kept such fields) loses them.
Test that every content file comes through its schema whole: parse it,
and compare (doreancon.org’s
test/contentSchemas.test.ts). Keeping the schemas in a plain module (src/schemas.ts) thatcontent.config.tsimports lets a test reach them. astro devruns in the background (Astro 7):astro dev status,logsandstop. A second one started on the same port quietly takes the next. A package imported only by client scripts goes invite.optimizeDeps.include, or pages fail to hydrate with “504 Outdated Optimize Dep” while Vite re-bundles it mid-load.
Printable pages
Section titled “Printable pages”A page that prints (a bulletin, a booklet, a poster) has no server to set its print layout, so:
- Build every layout into the page and switch between them with a class or an attribute, rather than re-rendering in the browser.
- Choose one with the URL: a script in
<head>reads?print=<mode>and sets an attribute on<html>before first paint, which the print stylesheet keys on. A tool that makes PDFs (headless Chromium) opens the page with it.
Back end: Rust on Lambda
Section titled “Back end: Rust on Lambda”A tier 2 site has one Rust function, svrbc-<domain>-api
(naming), serving everything under /api/*:
- An axum app, run by AWS’s
lambda_http. The same router runs as an ordinary local server during development, so there is no emulator. - Built for
provided.al2023on arm64: a static binary namedbootstrap. Graviton costs less per millisecond than x86. - Behind the site’s own CloudFront distribution, as a cache behavior for
/api/*that isn’t cached, with S3 for everything else. One origin means no CORS. The function URL takes the same secret header as a tier 3 site’s. - The Rust types are the API’s definition. Requests deserialize (serde)
into typed structs, so malformed ones are refused before a handler runs,
and the front end’s TypeScript types are generated from the same structs
(
ts-rs) in the build, rather than written twice. - State in DynamoDB, on demand, named like the function
(
svrbc-<domain>-<what>). It costs nothing idle. Lambda’s filesystem is temporary, which rules out SQLite. - Secrets in SSM Parameter Store, read by the function at start, never in the repository or OpenTofu state (AWS).
Buy rather than build what a service does whole: payments with Stripe Checkout or Payment Links, mail from a form with SES (below).
A form anyone can send is guarded by a hidden field, Cloudflare Turnstile and a filter on what it says, none of which loses a real person’s answers (Forms).
Sign-in that depends on church membership or a church role uses SVRBC accounts, which protects static pages too, so sign-in alone doesn’t move a site to tier 3. Never build another way to know who is a church member.
A service for the general public, whose sign-in has nothing to do with membership, has accounts of its own, in its own table, never SVRBC accounts: their people, groups and data stay apart from the church’s. It offers two ways in: a sign-in button in an email, and a passkey. No password and no code to type: the button is one tap from the mail app, and the passkey is the way in that doesn’t wait for mail. SVRBC accounts keep their code, since a members-only page is often opened in an installed PWA, which a link in an email can’t reach (Signing in). Decided 2026-11-14.
Every account system offers a way to merge two accounts: SVRBC accounts, and every public service’s own. People end up with two (a second address used before it was added, a shared address split later), and deleting one loses its groups, passkeys and history. So merging is there from the start, not a support task:
- Two ways in. The person merges from their account page, proving they control the other account with a code or button sent to one of its addresses; and an admin merges any two, for someone who has lost every way into one. A public service with no admins has the first only; its support address is the second.
- One survives: the one signed in, or the admin’s pick, with its id, name and primary address. The other’s addresses, passkeys and groups move to it, and the other is gone, its sessions ended.
- The old id is remembered for good, so a site that keeps data by account id can follow it.
- All or nothing, logged, and final: one transaction, and before the person confirms, the page shows what moves and says it can’t be undone. The limits on addresses and passkeys still hold (remove some first), and a disabled account can’t be merged.
Decided 2026-11-19. SVRBC accounts’ way: Merging accounts.
Start from
templates/public-accounts
rather than writing sign-in again: auth.svrbc.org’s code without the
membership, as a Rust API (the emailed button’s single-use token, passkeys,
a host-only __Host- session cookie) and a sign-in and an account page.
The button’s page spends the token only on a click (“Continue signing
in”), not on load: there is no code to fall back on, so a mail scanner that
runs the page must not be able to use up the way in.
It is built and tested here, passkeys and all, so what a site copies works;
its README says what to copy and what to rename. No public service runs it
yet: the first one settles its infrastructure and records it there. It
doesn’t merge accounts yet, and must before a service runs it.
This is for APIs a site calls. Tools and bots keep their own rules: the
single-file Python of tools/, and the
review bot.
Building the function
Section titled “Building the function”Bazel builds the API with
rules_rust, every crate a step
of its own, with the toolchains of svrbc_rust
(bazel/rust/,
a module beside svrbc_bazel). Decided 2026-11-27, replacing Cargo inside a
single Bazel step. Cargo.toml and Cargo.lock stay the source of the
dependencies, and cargo works in the crate as before, for iterating.
templates/public-accounts/api/BUILD.bazel
is the worked example; copy its shape.
Why. Cargo in one step can only be cached whole: the step’s key covers
every source file, so any edit compiled every dependency again, from
nothing, in each step that ran Cargo (the zip, cargo test, any other
binary), each downloading every crate first: minutes for a one-line change,
paid again by svrbc-mr before every merge request. With rules_rust each
dependency is a step of its own, compiled once per Cargo.lock for every
machine through the shared cache, and an edit recompiles only the crate, its
tests and the function. A dependency step for Cargo caches the dependencies
too, but only all together, and only on one machine’s copy of the work.
What it costs: a fresh checkout fetches more while Bazel loads the build
(rules_rust itself and the crates’ sources, kept in Bazel’s download cache,
so once per machine), and a generated cargo-bazel-lock.json (below) is
committed.
Why a module of its own. Depending on rules_rust makes Bazel fetch it
in every build, Rust or not. svrbc_rust is a second module from this
repository (strip_prefix = "bazel/rust"), at the same commit as
svrbc_bazel, which only a repository with Rust depends on.
The toolchains are the pinned Nix one, fetched only when a step runs.
rules_rust’s own toolchains download rustc while Bazel analyses the build,
before it knows that every step is a cache hit, which is what
nix_tools exists to
avoid. svrbc_rust’s extension gives it, instead, small wrapper scripts
around the toolchain a repository already pins (its nix/rust.nix, a
nix_tools tool), for rustc, cargo and both C compilers. Each wrapper names
the toolchain’s store path, which Nix knows from the recipe without
downloading anything, and fetches the toolchain the first time a step runs
it.
-
The toolchain is a pinned tool, a few lines of Nix (the template’s
nix/rust.nix): nixpkgs’pkgsCross.aarch64-multiplatform-musl.buildPackages.{rustc,cargo}, that target’sstdenv.ccas the cross compiler and linker, and the host’sstdenv.cc, for build scripts, proc macros and tests. All of it is in cache.nixos.org at the shared nixpkgs pin, so nothing compiles to get it; no rustup, zig orcargo lambda. -
MODULE.bazeldepends onrules_rustandsvrbc_rust, names the toolchain tosvrbc_rust’s extension and registers it, and hascrate_universeread the crate’sCargo.tomlandCargo.lockwithsvrbc_rust’shost_tools:bazel_dep(name = "rules_rust", version = "0.75.0")bazel_dep(name = "svrbc_rust", version = "0.0.0")git_override(module_name = "svrbc_rust",remote = "https://gitlab.com/svrbc/developers.svrbc.org.git",commit = "<svrbc_bazel's commit>",strip_prefix = "bazel/rust",)rust = use_extension("@svrbc_rust//:extensions.bzl", "rust")rust.toolchain(tools = "@nix_tools//:tools.bzl", rust = "rust", coverage = "rust_coverage")use_repo(rust, "svrbc_rust_toolchains")register_toolchains("@svrbc_rust_toolchains//:all")crate = use_extension("@rules_rust//crate_universe:extensions.bzl", "crate")crate.from_cargo(name = "crates",cargo_lockfile = "//api:Cargo.lock",host_tools = "@svrbc_rust_toolchains//host:tools",lockfile = "//api:cargo-bazel-lock.json",manifests = ["//api:Cargo.toml"],supported_platform_triples = ["aarch64-unknown-linux-gnu", "x86_64-unknown-linux-gnu"],)use_repo(crate, "crates") -
.bazelrchascommon --@rules_rust//rust/settings:toolchain_generated_sysroot=false. Nix’s rustc wrapper then gives rustc the toolchain’s own sysroot, which holds the standard library for both targets; with the flag left out, rules_rust points rustc at a sysroot without one and nothing compiles. -
api/cargo-bazel-lock.jsonis committed. It is crate_universe’s rendering ofCargo.lockinto Bazel targets, so loading the build runs no Cargo. After changingCargo.tomlorCargo.lock, runCARGO_BAZEL_REPIN=1 bazel build //api/...to rewrite it; until then the build fails, saying so. Checking the lock runs onlycargo --versionandrustc --version, whichsvrbc_rust’shost_toolsanswer from the pin, so even that fetches nothing. -
Lambda’s target is
aarch64-unknown-linux-musl, but its dependencies are chosen as foraarch64-unknown-linux-gnu(supported_platform_triples): rules_rust has no setting for the musl one, and the gnu one has the same constraints. A crate that depends on something only for musl would be missed, so comparecargo tree --targetfor the two when the dependencies change. -
api/BUILD.bazelhas arust_libraryof the crate (named as the crate is), arust_binaryfor each binary, arust_testof the library and one for each file intests/, each withall_crate_deps(…)from@crates. The function islambda_binary(@svrbc_rust//:defs.bzl) of its binary, zipped asbootstrapwith a genrule: the binary and every crate it links built for Lambda, statically linked, in opt with opt-levels, fat LTO, one codegen unit and no symbols, as Cargo’s release profile (lto = true,codegen-units = 1,opt-level = "s",strip = true). Zip it deterministically, so an unchanged binary is an unchanged zip and the release skips the function. -
Coverage is
rust_coverage_testof the tests: they are built again with-Cinstrument-coveragefor the repository’s own crates only, run, and their line coverage ofsrc/written as LCOV for CI’s coverage job (Test coverage). -
What Cargo gave a test, Bazel gives otherwise.
env!("CARGO_MANIFEST_DIR")is the package’s path (giverustc_env), and its files aredata; there is noCARGO_TARGET_TMPDIR(readTEST_TMPDIR, which Bazel sets, as the template’stests/bindings.rsdoes);CARGO_BIN_EXE_<name>is given asrustc_envwith$(rootpath :<name>), relative to where the test starts, so make it absolute before a test changes directory. -
The types reach the front end through
ts-rs, into a committedapi/bindings/; a test fails when they’re stale, and the site’s build copies them in. -
Secrets are read by name (
ssm:GetParameters): the workload boundary allows noGetParametersByPath. A value the function keeps for itself (svrbc.org’s YouTube OAuth token) can live beside them, under/svrbc/<site>-api/state/, which the boundary lets a function write; DynamoDB is for more than a value or two. svrbc.org signs its SSM calls itself (SigV4, a few dozen lines) rather than linking the AWS SDK.
Email: Amazon SES
Section titled “Email: Amazon SES”A site’s mail goes through Amazon SES, from an address at the site’s own domain, sent by its API with the function’s role (AWS): no API key to keep, one bill, and no third party holding the site’s readers’ addresses. doreanpress.org is the example.
- One domain identity per sending domain, its own stack
(
infra/<domain>-ses), signed with Easy DKIM (RSA 2048). Its three DKIM CNAMEs go in the domain’s DNS stack once the identity exists (itsdkim_tokensoutput), so it takes two merge requests; SES verifies the domain within minutes of their resolving. DMARC passes on that signature. - One configuration set per sender (
svrbc-<domain>), in the site’s stack, so each sender’s bounces and complaints are counted apart. - The function sends only from its own domain: its role allows
ses:SendEmailon that identity and configuration set with ases:FromAddresscondition (*@<domain>), inside the workload boundary, which allows sending and nothing else. - SES v2
SendEmailover HTTPS, signed like every other AWS call the function makes (no SDK; auth.svrbc.org’sapi/src/aws.rsandmail.rs). Every message has a text and an HTML part. Without aMAIL_FROM(a local run, the tests) the function writes mail to the log instead, and on Lambda it never does. - Production access is the account’s, asked for once. A new account is
in SES’s sandbox: 200 messages a day, only to verified addresses. An
administrator asks AWS to leave it (
aws sesv2 put-account-details --production-access-enabled --mail-type TRANSACTIONAL …), describing what is sent and how bounces are handled;aws sesv2 get-accountshows the review. SVRBC’s account has it. The account-level suppression list is on for bounces and complaints. - Mail from a form or a sign-in only: transactional, in answer to the reader’s own action. A newsletter is a different service’s job.
Tier 3: Astro, rendering on the server
Section titled “Tier 3: Astro, rendering on the server”When a page’s HTML depends on who asks, that page renders on the server, and the rest of the site stays static. It’s still Astro:
- Per page, not per site.
export const prerender = falseon the pages that need a request; everything else is built at release as before. @astrojs/node, instandalonemode, run on Lambda by AWS’s Lambda Web Adapter, a layer that lets an ordinary web server answer Lambda’s requests. Astro has no official Lambda adapter, and the community ones aren’t worth depending on; the Node adapter is Astro’s own, and the Web Adapter is AWS’s.- Hosted like any server-rendered site (Hosting): the
function behind CloudFront, its static files (
dist/client) in S3. The function-URL traps apply (the visitor’sHost, the secret header); the ones about Nuxt and Nitro don’t. - Its own endpoints and actions serve what its pages need, with the session that signed the visitor in. Anything more than that, or shared with another site, is still a Rust function.
A pilot: no SVRBC site runs Astro on Lambda yet, and the first tier 3 site settles the details and records them in Hosting.
Nuxt is not a tier.
Several hosts, one static build
Section titled “Several hosts, one static build”Serving several hostnames doesn’t make a site tier 3 by itself. If its tenants are known when it’s built, build each one statically, in one build:
- One directory per host. A page under
src/pages/[host]/lists, in itsgetStaticPaths, the hosts it applies to, so each host gets only its own pages:dist/www/,dist/2025/,dist/travel/. Files every host shares (_astro/,images/) stay at the top, once. - A CloudFront function routes. It picks the directory from the
hostname (
/hymnson2025.example.orgis/2025/hymns/index.html), passes shared files through, and answers the redirects (the bare domain, a host that moved, old paths). The redirects and the list of hosts come from the build, as JSON an endpoint writes, so the function is the site’s code, published by each release, not infrastructure. - The same file routes the dev server. An Astro integration runs it as
Vite middleware, and a small Node server runs it over
dist/for previews and PDF renders:2025.localhost:4321is the 2025 site. Browsers resolve*.localhoston their own. - Links between hosts are written out in full when a page is built: on
the real domain in a build, on
*.localhost:4321underastro dev. - The function rewrites before the cache looks, so a page’s cache key is its file’s path, the Host header needn’t be in it, and a release invalidates exactly the files it changed.
- CloudFront Functions take 10 KB of code. Routes and a few dozen redirects fit; past that, keep the redirects in a CloudFront KeyValueStore the release writes.
doreancon.org is the example:
router/router.js,
src/tenants.ts,
src/pages/router.json.ts
and the dev server’s side in its astro.config.mjs.
Where sites stand
Section titled “Where sites stand”| Site | Tier | Built with |
|---|---|---|
| auth.svrbc.org | 2 | Astro, static, and a Rust API: SVRBC accounts (being built) |
| developers.svrbc.org | 1 | Starlight |
| anorthodoxcatechism.org, baptistcatechism.org, baptistconfession.org | 1 | Astro, static, one directory per host, from one project (svrbc/symbolics-sites) |
| doreancon.org | 2 | Astro, static, one directory per host (above), and a Rust API for its sign-up forms, whose answers go to a Google Sheet through its Apps Script web app rather than to DynamoDB: the organizers work in the sheet |
| recipes.svrbc.org | 1 | Astro, static |
| svrbc.org | 2 | Gridsome on Netlify, with Netlify functions for form mail, Scripture text, the live stream’s status and the sermon sync (moving to Astro and a Rust API in steps) |
svrbc-audit warns about a site built with something
other than Astro, an Astro site that renders on a server without the Node
adapter or without a reason in its AGENTS.md, and an API that isn’t Rust.
Open questions
Section titled “Open questions”- Astro on Lambda through the Lambda Web Adapter: the first tier 3 site pilots it.