Skip to main content

Crate sapphire_framework_server

Crate sapphire_framework_server 

Source
Expand description

The app server skeleton.

An application builds one of these, adds its own methods, and runs it. Everything a sapphire app needs on the server side — owning its workspace, answering workspace.*, pushing events — is here. A server serves one workspace at a time (#215): see Current.

See docs/superpowers/specs/2026-09-16-process-architecture-design.md §4.

ⓘ
static CTX: AppContext = AppContext::new("sapphire-journal");

AppServer::new(&CTX, env!("CARGO_PKG_VERSION"))
    .extend(|router| router.method("journal.create_entry", create_entry))
    .run()
    .await?;

Application methods are named <app>.<method>. The framework owns workspace.* and server.*; anything else is the application’s.

Re-exports§

pub use sync::BackfillTiming;
pub use sync::BridgeConnector;
pub use sync::SyncRuntime;
pub use sync::SyncStatus;
pub use sync::sync_router;

Modules§

sync
Replication, from the app server’s side.

Structs§

AppServer
An application’s server.
AppUpdateArgs
update’s arguments in an application: its own, and whether the bridge follows.
Current
The server’s current workspace.
HttpConfig
The [http] table: the listener every HTTP route shares.
McpConfig
The [mcp] table.
ReleaseSource
Where a binary’s releases are published: a GitHub repository whose releases are tagged <prefix><version>, and — for the update command — the file in them.
Selection
What workspace.toml holds.
SelectionFile
The selection file, read and written whole.
ServerConfig
What server.toml holds.
StatusReport
The typed answer to a status question, shared by the CLI and the IPC server.info response (spec decision 4).
StatusRow
One application-provided line of the status report.
UpdateArgs
The update subcommand’s arguments: replace this executable with its newest release.
UpdateConfig
The [update] table.
WorkspaceHost
The workspace this server has open.

Enums§

DeviceCommand
The device subcommands.
Error
Errors raised while serving an application’s workspaces.
FrameworkCommand
The framework’s commands, flattened into an application’s CLI (spec decision 2).
WorkgroupCommand
The workgroup subcommands.
WorkspaceCommand
The workspace subcommands (#215: one workspace per server).
WorkspaceSyncCommand
The workspace sync subcommands: the server’s workspace’s sync, switched after the fact.

Constants§

SELECTION_FILE
The file’s name inside the application’s config directory.
SERVER_CONFIG_FILE
The file’s name inside the application’s config directory.

Functions§

render_workspace
Render the server’s workspace as the CLI prints it: root state.
subscribe_method
Add workspace.subscribe to router.
workspace_router
The file methods of workspace.*, on the current workspace (#215).

Type Aliases§

Result
Convenience alias for server results.