Introducing a new way to review your PRs.

Read the announcement

fwdai / rowel

🔑 Local-first Secrets Manager

View on GitHub

23 documents · Updated Oct 9, 2026

docs / application-shell

Application shell and user journeys

The React application presents one vault through three top-level flows: first-run setup, vault unlock, and everyday use. The shell chooses the flow from the app status, keeps the locked and unlocked states separate, and moves the user from setup or unlock into a responsive workspace.

Shell model

The application shell is the top-level view switch. It draws setup when the device has no vault, an authentication screen when a vault is sealed, and the main workspace after a successful unlock. The shell also keeps update feedback above the active flow, so a staged update does not change the current journey. See Frontend startup, Main workspace interface, and Client state and preferences for focused views of these areas.

The main states form a simple user journey:

StateUser goalNext state
SetupCreate or restore a vaultAuth or main
AuthOpen the selected vaultMain
MainRead and manage vault dataAuth on lock

Startup and routing

Startup prepares the language, preferences, platform status, and window before React draws the first useful screen. The launch probe reports whether a vault exists, which workspace is active, whether sync and scanning are available, and whether biometric unlock can be used. A failed probe does not leave the window blank; the shell stays on the lock flow and can ask for status again.

The startup path follows this order:

  1. The entry point blocks browser reload shortcuts that would discard an unlocked session.
  2. Boot reads any host-provided settings and starts the splash handoff.
  3. Language data and app status load in parallel.
  4. A device with no initialized vault enters setup before the first main render.
  5. React mounts the shell and listens for backend events.
  6. Setup and main screens load on demand while the lock screen remains available.

This diagram shows how launch facts select the first user-facing flow.

flowchart TD
    A[Application entry] --> B[Boot language and app status]
    B --> C{Vault initialized?}
    C -- No --> D[Setup flow]
    C -- Yes --> E[Auth flow]
    D --> F[Create or restore vault]
    F --> G[Main flow]
    E --> H[Password or biometric unlock]
    H --> G
    G --> I[Everyday vault use]
    I --> J[Lock or auto-lock]
    J --> E

References: src/main.tsx• L1-22 src/boot.ts• L11-23 src/boot.ts• L73-115 src/App.tsx• L11-18 src/App.tsx• L52-94

Setup journey

Setup is the first-run path for a device without a local vault. It offers three goals: start with a new master password, restore data from Google Drive, or restore a desktop backup file. The flow keeps these choices separate because each source needs its own way to find and open encrypted data.

The journey moves through these user choices:

  • Start fresh: choose a strong master password, then choose Google Drive sync or local-only storage.
  • Google Drive: connect an account, inspect any vaults found there, then either restore one or start fresh in that account.
  • Backup file: choose a .rowel file and enter the password that sealed it.
  • Biometric unlock: after the new or restored vault is open, optionally enroll the device biometric gate for later unlocks.

The setup shell owns the back path and the current step. A successful create or restore does not enter the workspace until the optional biometric question is complete or skipped. This keeps enrollment tied to an already open vault while still allowing the user to defer it.

References: src/…/index.tsx• L32-50 src/…/index.tsx• L151-209 src/…/index.tsx• L17-65 src/…/index.tsx• L18-23 src/…/index.tsx• L30-34 src/…/index.tsx• L21-25 src/…/index.tsx• L19-22

Unlock journey

The authentication flow opens an existing vault without exposing its contents. It lets the user choose a workspace, enter the master password, or use an enrolled biometric gate. Desktop and compact layouts present different controls, but they share one unlock action and one result path.

An unlock attempt has four visible outcomes:

  • Waiting: the vault remains sealed and accepts an unlock method.
  • Verifying: the attempt is in progress and duplicate attempts are blocked.
  • Error or lockout: the user sees whether the attempt failed or must wait before trying again.
  • Success: the vault opens, the main workspace receives its entry list, and an initial sync and audit can begin.

The shell delays the handoff briefly after success so the transition is clear. It also waits for the window to be focused when needed, which prevents the unlocked view from appearing behind an operating-system biometric prompt.

References: src/…/index.tsx• L16-47 src/…/LockScreen.tsx• L19-23 src/…/useUnlock.ts• L41-77 src/…/useUnlock.ts• L135-185 src/…/app.ts• L264-279

Main workspace

The main workspace is the everyday vault experience. It combines navigation, a searchable and filterable entry list, a detail or edit area, and shared actions such as adding entries, generating values, sharing, scanning, and opening settings. The workspace has one product model but two layouts: a wide layout keeps the main panes visible together, while a compact layout presents one screen at a time.

The wide layout provides:

  • A rail for adding entries, changing views, locking, and opening settings.
  • A list column for the current view and its sort control.
  • A detail pane for reading, creating, or editing the selected entry.
  • A top sync indicator that reports vault sync state.

The compact layout derives its visible screen from the same client state. A draft or edit takes priority, followed by settings or a standalone generator, then entry detail, and finally a tab root. This lets commands, saves, and backend events change the visible screen without a second routing system.

References: src/…/index.tsx• L18-52 src/…/Wide.tsx• L6-21 src/…/index.tsx• L10-43 src/…/index.tsx• L7-30 src/…/index.tsx• L11-27 src/…/index.tsx• L28-74

Everyday vault use

Everyday use centers on selecting an entry, viewing its details, and changing the vault through focused surfaces. The primary views are all items, favorites, archive, and tags. Settings adds controls for sync, security, audit, import, language, and workspaces without changing the vault's core list and detail model.

The workspace also protects the user's current context. A draft makes the list inert until the draft is resolved. Filters that would hide a newly saved item are cleared so the result remains visible. Modal surfaces own keyboard actions while they are open, and the privacy screen covers the unlocked workspace when the app needs to hide secrets from the app switcher.

References: src/…/ui.ts• L14-19 src/…/ui.ts• L148-188 src/…/ui.ts• L190-243 src/…/vault.ts• L95-115 src/…/vault.ts• L143-155 src/…/index.tsx• L41-51

Lock and session boundary

Locking ends the in-memory vault session and returns the shell to authentication. The same boundary handles a manual lock, inactivity auto-lock, a tray action, and a workspace switch. One event path clears vault rows, open surfaces, and cached site icons so the next unlock cannot inherit secrets or controls from the prior session.

State has two useful lifetimes:

LifetimeExamplesResult of lock
Persistent or process-widePreferences, flow status, sync status, update stateRetained for the next flow
Unlocked sessionVault rows, selection, filters, dialogs, remote vault listCleared before auth returns

After a successful unlock, the app restores the entry list and may run sync and an audit. A lock therefore removes the old view first, rather than merely hiding it, and the next main view starts from the newly opened vault.

References: src/…/index.ts• L1-13 src/…/app.ts• L239-262 src/…/events.ts• L37-70 src/…/vault.ts• L17-22 src/…/ui.ts• L6-12

Backend event relationship

The shell is a view of backend state, not the owner of vault security or sync. Backend events update the client stores for sync, merged vault data, setup probes, workspace changes, opened files, and locks. This keeps actions from different entry points consistent: every kind of lock reaches the same session cleanup, and every sync update reaches the same visible status.

The main event relationships are:

  • A vault merge replaces the visible entry list and refreshes audit information.
  • A setup probe changes the first-run Drive choice between waiting, found, empty, and failed.
  • A workspace or file event routes data to the setup or import surface that can use it.
  • A lock event clears session state and shows authentication again.

References: src/…/events.ts• L18-35 src/…/events.ts• L37-70 src/…/app.ts• L51-99 src/…/app.ts• L157-196

Change checklist

When these files or sections are changed, remember to consider these:

  • Keep the initialized decision consistent between the pre-render route in src/boot.ts and the fallback route in src/App.tsx.
  • Keep the flow values and their shell branches aligned with setup, auth, and main entry points.
  • Preserve the handoff contract from UnlockResult to enterMain, including the initial entry list and sync configuration.
  • Route every lock source through the vault:locked event so session data is cleared before the next unlock.
  • Keep wide and compact shells on the same store actions when adding a new workspace surface or navigation path.
  • Keep backup-file delivery safe for both a launch-time file and a later file:opened event.

Important failure modes

TriggerConsequenceGuard
The launch status probe failsThe app cannot know whether setup is needed and remains on authenticationRender the lock flow by default and let the mounted shell retry the probe
A lock clears only part of session stateThe next vault can show rows, filters, dialogs, or icons from the previous vaultHandle all lock causes in the single vault:locked event reaction
A password attempt starts during a workspace switchThe request can open a vault different from the one shownDisable unlock actions while switching is active
A Drive probe reports existing data as an empty accountSetup may create a new vault instead of offering restoreLet the setup Drive status decide between create and conflict paths
A wide or compact shell adds its own navigation stateCommands and saves can update one layout while the other shows a different routeDerive both layouts from the shared app, UI, and vault stores
An opened backup is consumed before a restore-capable screen reads itThe user loses the restore handoffKeep the opened path in app state and clear it only when a screen claims it

Key files

FileWhy to read it
src/main.tsxShows the browser entry point and the call into boot.
src/boot.tsDefines launch preparation, status probing, setup routing, and the first React render.
src/App.tsxDefines the top-level flow switch, lazy loading, event subscription, and splash handoff.
src/…/app.tsDescribes flow state, unlock entry, lock handling, setup status, and sync coordination.
src/…/events.tsShows how backend events drive the visible shell and session boundary.
src/…/index.tsxShows the complete setup journey and its handoff into an open vault.
src/…/useUnlock.tsShows the shared unlock lifecycle used by wide and compact authentication screens.
src/…/index.tsxShows the common main workspace frame and its overlays.
src/…/Wide.tsxShows the wide workspace composition.
src/…/index.tsxShows how the compact workspace derives its current screen.
src/…/index.tsExplains the lifetime split between preferences, app state, vault state, and UI state.