SpokenWords

App Architecture

This developer guide explains how the code is organized. For user guidance on roles and production workflow, start with the Overview.

The sections below describe dependencies between pages, app components and library modules. The shared UI library has separate documentation linked below.

Dependency Diagram

Read the diagram from top to bottom: pages load app.mjs and app components, which use shared UI components and library modules. An indented component is opened or mounted by the component above it.

Pages Universal entry point App Components UI Components Lib Modules
Dependency diagram of the app's pages, components and lib modules Five layers show pages, the shared app entry point, app components, shared UI components, and library modules grouped by domain. Indentation indicates mounted components; arrows indicate dependencies. The sections below list individual module imports. Pages index.html auth.html productions.html studio.html jobs.html local-audio.html Shared app.mjs app-account-menu app-lang-select App Components app-productions app-project-import app-project-edit app-workflow app-production-details app-article-preview app-team-members app-add-member app-advanced app-studio-header app-held-takes app-studio-toolbar app-declined-saves app-studio-reader app-sentence-waveform app-studio-search app-studio-footer app-studio-panel side-panel app-bookmarks app-audio-processing app-content-navigator app-article-overview app-delivery-checklist bg-jobs app-local-audio UI Components (shared) Shared by pages and app components; individual dependencies are listed below. ui-icon ui-dialog ui-menu ui-popover ui-tab ui-outlet ui-toolbar ui-combobox ui-notifications ui-notification-item ui-statusbar ui-theme-toggle ui-code x-select Lib Modules Library modules by domain. Arrows show dependencies between groups; individual imports and UI helpers are listed below. State studio-state editor-state article-state workflow-stage workflow-actions assignment-rows project-health delivery-check content-types studio-settings session-store bookmarks studio-actions production-menu sentence-issues diagnostics Sync & Jobs sync-pipeline webarch-socket commit-flow Audio & Recording audio-store recording-state recording-session wav-recorder playback previous-audio take-row held-takes vu-meter audio-levels audio-processing waveform-data playhead-mark audio-format mic-devices speech-estimate live-tracking stt Text Processing sentences annotations annotation-groups annotation-paint guidance-annotations sentence-status text-search wdf-html alignment ipa-lookup article-figures Auth & API api auth auth-error teams crew Config & Utilities activity stt-elevenlabs project-languages version AppElement

How to read the diagram

The diagram shows which pages load each component, which components mount others, and dependencies between groups of library modules. Drawing every import would make the diagram unreadable. For individual imports, use the per-page and per-module lists below.

Shared components appear once in the diagram. bg-jobs and app-local-audio also appear inside app-advanced; app-workflow opens from both members and production cards; and side-panel underlies three studio panels. The studio.html section maps module names to exported classes. index.html initializes localization independently and has no auth guard, so it has no dependency on app.mjs.

Shared: app.mjs & UI Components

app.mjs — Universal entry point

App pages load this entry point; landing and error pages initialize separately. Each page loads preload.mjs as its first module script, before this one; app.mjs does not import it. app.mjs initializes authentication, applies data-auth="required" / "guest" guards on <body>, warns before session expiry and renews on interaction. It also registers the service worker and translates static markup before revealing body.ready. It defines <app-account-menu> for account, language, theme and sign-out controls. On a signed-in page it also starts the device-local speech model's install through stt-notice, which reports it in that page's statusbar.

UI Components

Reusable Web Components with ui- or x- prefix. Most extend a base using UiElement.mjs helpers.

index.html — Landing Page

Introduces SpokenWords and links to the app and documentation. It initializes localization to translate its static markup without loading app.mjs or applying a data-auth guard. It loads ui-icon and ui-theme-toggle.

auth.html — Authentication

Signs in existing accounts, which administrators create. The data-auth="guest" guard redirects signed-in users to Productions or the page that originally requested sign-in.

Imports

productions.html — Dashboard

Main dashboard with production list, team members, and the Advanced hub. Auth guard: data-auth="required".

App Components

Dialog and view sub-components

UI Components used

studio.html — Recording Studio

The inline script reads ?id= and optional &article= parameters, creates state and tracking objects, and initializes panel classes against existing markup. It coordinates recording, editing, playback and synchronization. The page requires data-auth="required".

State objects (initialized in inline script)

sync-pipeline handles uploads as a shared module used through RecordingState and StudioFooter. The page follows export outcomes through commit-flow.

App Components (exported classes, not custom elements)

Components loaded by the studio panels

These custom elements and the shared base class are loaded by the panels above. They appear as indented boxes in the diagram's studio column.

UI Components used

jobs.html — Job Queue Monitor

Background job status tracking. Auth guard: data-auth="required".

App Components

local-audio.html — Local Audio Manager

Manage locally cached audio files in IndexedDB. Auth guard: data-auth="required".

App Components

Lib Modules

Grouped by domain. Arrows (→) show imports from other lib modules.

Config & Utilities

Auth & API

UI Helpers

Text Processing

Audio & Recording

Sync & Jobs

State