Skip to content

Architecture ​

Altar Studio is a Tauri 2 application. A Rust backend owns the data and the live state, and React interfaces running in the system webview (WebView2 on Windows, WKWebView on macOS, WebKitGTK on Linux) draw the windows. A second app, Altar Studio Autopilot, can follow the service by listening and ask the backend to move Live.

                  ┌──────────────────────────── Rust backend ───────────────────────────┐
                  │  coordinator    outputs        library / db      assets   bible     │
                  │  (Preview,      (displays,     (SQLite, FTS5)    (SHA-256 backup    │
                  │   Live, acks)    windows)                         store)  package   │
                  └──────▲──────────────┬───────────────▲───────────────────────────────┘
          commands       │   events     │               │ commands
     (full permissions)  │  live:state  │ live:frame    │ (render + acknowledge only)
                         │              ▼               │
     ┌───────────────────┴───┐   ┌───────────────┐  ┌───┴───────────┐
     │ Control window        │   │ Audience      │  │ Confidence    │
     │ (operator interface)  │   │ window        │  │ window        │
     └───────────────────────┘   └───────────────┘  └───────────────┘

One codebase, four roles ​

Every window loads the same interface bundle. src/App.tsx reads the window's role and loads only the matching app:

RoleAppPurpose
controlControlAppThe operator interface
audienceAudienceAppDraws the live scene
confidenceConfidenceAppDraws the stage display
identifyIdentifyAppThe numbered test pattern

The backend creates output windows itself and injects the role and a session ID with an initialisation script (window.__ALTAR__ = {…}). Query strings are unreliable for app URLs, and the content security policy blocks inline scripts. In the browser preview, the role comes from ?role= instead.

Sharing one renderer (src/render/) between the control window's monitors and the output windows is what makes the Live monitor an honest picture of the audience screen. Both draw the same Frame with the same code.

The backend owns the truth ​

Three things live in Rust, not in the interface:

  1. The library and services, in SQLite (db.rs, library.rs). The interface keeps caches (useWorkspace) but saves every change through backend commands.
  2. Media, in a content-addressed store (assets.rs): each file is named by the SHA-256 hash of its bytes.
  3. The live state: Preview, Live, Black/Logo, lower thirds, media transport, countdown and stage message (coordinator.rs).

Listening is in Rust too. speech.rs captures the audio input and transcribes it offline, and sends the text to the control window as events. The control window finds the Bible references in it (src/lib/spokenRefs.ts) for the Heard list. Nothing goes on screen by itself.

The interface sends commands and receives events. The control window holds a mirror of the live state from live:state events. It never decides what's live by itself.

Putting the live state in the backend means it doesn't depend on any one window. An output window that crashes and reloads asks for the current frame and carries on. A new output opened mid-service shows what's live straight away. Every commit goes through a single lock, in order. The live coordinator explains the protocol.

A pinned, fully resolved scene ​

The control window does all the expensive work: it lays out text, fits it to the screen, resolves themes and backgrounds, and checks readiness. What it sends to the backend is a pinned target: a fully resolved list of RenderSlides, the slide index, and the content revision. The backend treats the slides as opaque JSON. It checks only that the list isn't empty, the index is in range, and the slide is ready.

So output windows need no access to the library, themes or Bible. They only need the frame and a way to turn an asset hash into a file. That's why their permissions can be so narrow.

Frontend structure ​

FolderContents
control/Pages (Present, Library, Services, Settings), editors, dialogs, keyboard handling
output/The audience, confidence and identify apps
render/Layout engine (layout.ts), SceneView, SlideRenderer, keyer, camera, transitions, fonts
state/zustand stores
lib/Typed backend bindings (api.ts), the mock backend, domain types, parsers for scripture references (typed and spoken), song text and documents

State is split into small zustand stores by responsibility. See Project layout. Only per-computer interface preferences, such as light/dark and the interface font, go in localStorage. Everything else is saved in the workspace.

Running without Rust ​

src/lib/api.ts checks whether it's running inside Tauri. If not, invoke() and listen() load src/lib/mock-backend.ts, an in-memory imitation of the backend saved to localStorage. It includes a JavaScript copy of the coordinator, simulated displays, and popup windows for outputs. That makes npm run dev enough to work on most of the interface in a browser.

The mock is deliberately simpler than the backend:

  • Packages, PowerPoint import and installing a speech model from a file report "This action needs the desktop app". Backup restore isn't available.
  • Listen plays a scripted sermon instead of hearing a microphone, and its "Sound desk" input is silent, to show the No sound warning.
  • Autopilot can't run: switching it on reports that it needs the desktop app.
  • The mock coordinator doesn't validate readiness or log history.
  • Search is a simple substring filter, not FTS5.

Check coordinator, file and display behaviour in the desktop app.

Startup ​

  1. The backend opens the last workspace (from config.json in the app config folder), starts the display watch, and loads Autopilot's track record.
  2. A small borderless launch window (splash.html, label splash) opens first. After two seconds, splash.rs creates the control window, maximized, from its tauri.conf.json entry (which has "create": false) and sets up camera permissions, then closes the launch window. The control window is created before the launch window closes, because closing the last window would quit the app.
  3. The control window shows its own splash from its first paint (src/lib/splash.ts) and waits for fonts to load, because slide text is measured on a canvas and needs the real fonts. Then it initialises its stores, subscribes to events, and loads the service list. The splash stays for at least half a second and until the workspace has loaded, and never more than 15 seconds.
  4. On a new workspace it shows the first-run wizard. Otherwise it reopens the last service and sets up the logo.

Closing the control window closes every other window, and saves are flushed before it goes.

Autopilot: a second app ​

Autopilot (autopilot/) is a separate Tauri app that listens to the service and follows it: it opens announced scriptures, steps through readings, songs and The Word's points, and suggests or moves slides. Being a separate app, it can also run on another computer, such as the one at the sound desk with the desk feed. See Autopilot for what it does.

   ┌─────────────── Altar Studio ───────────────┐            ┌────────── Autopilot ──────────┐
   │ coordinator.rs ◄── autopilot.rs            │  Link      │ link.rs ◄── follower (window) │
   │ (Live, rules)      (Link server, launch) ◄─┼────────────┼─►            ▲               │
   │                         │ events           │ WebSocket  │              │ text          │
   │                         ▼                  │            │ listen.rs (altar-speech)      │
   │                    control window          │            │              ▲                │
   │                    (autopilotBridge.ts)    │            │         microphone            │
   └────────────────────────────────────────────┘            └───────────────────────────────┘

Altar Studio stays in charge of Live. It runs the Link server, tells Autopilot what's live and what the live item says, and carries out Autopilot's commands only when its own rules allow them. Each command names the Live revision it was decided on, and the coordinator checks it under its lock, so nothing can change Live in between. The live coordinator lists the rules.

The Link is a WebSocket connection carrying JSON messages defined in crates/autopilot-link, which both apps use. Its PROTOCOL number, not the app versions, decides whether the two can work together.

  • On the same computer (the default), Altar Studio launches Autopilot in the background (altar-autopilot --altar-studio) when the operator switches it on for The Word or Songs & hymns. The server listens on the loopback address only, at a random port. The address, a one-time key and the speech-model folder go to Autopilot on its standard input, which stays open: when Altar Studio goes away, Autopilot exits.
  • On another computer (network mode), Altar Studio listens on port 47820 and announces itself with Bonjour as _altar-autopilot._tcp, under its own host name (altar-studio-<id>.local) rather than the computer's, which would make macOS rename the computer. The two computers pair once with a six-digit code (SPAKE2), and every later connection runs a Noise handshake with the pair key and encrypts each message (ChaCha20-Poly1305).

Opening scripture and going back to The Word need slides laid out, which only the control window can do. Rust decides Live or Preview, then hands the request to the control window (autopilot:request). src/state/autopilotBridge.ts builds the target exactly as the operator's own Go Live would, with the scripture split, effects and live history, and sends it with live_go, marked as Autopilot's so the coordinator applies Autopilot's rules.

One listener per service. While Autopilot is on, Altar Studio's Listen is off: Rust stops it and waits for the microphone to be released before Autopilot opens it. Autopilot's text then fills the Heard list (autopilot:transcript).

The speech engine is shared. crates/altar-speech (audio input with cpal, voice detection and transcription with sherpa-onnx, model downloads) is used by Altar Studio's Listen and by Autopilot. On the same computer, Altar Studio passes Autopilot its speech-model folder, so a model is downloaded once.

Nothing leaves the building. Audio is transcribed where it's captured. The text travels only over the Link, to Altar Studio. The decision log (autopilot/logs/) and each kind's track record (autopilot/track.json) are kept in Altar Studio's local data folder, and recordings, made only when the operator starts one, in Autopilot's. Nothing is uploaded.

Why Tauri and Rust ​

The choices follow from what a service needs:

  • Offline and local. No server, no account. SQLite and a folder of files are easy to back up and move.
  • Reliable live output. One owner of the live state, with serialised commits and acknowledgements, is easier to make correct in Rust than across several webviews.
  • Small installers and native windows. Tauri uses the system webview instead of bundling a browser, and gives direct control of borderless full-screen windows on particular displays.
  • Least privilege. Tauri's per-window capabilities let the audience window have only the four commands it needs.

Altar Studio by Milton Black. Free and open source.