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::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.
Current
The server’s current workspace.
Selection
What workspace.toml holds.
SelectionFile
The selection file, read and written whole.
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.
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).

Constants§

SELECTION_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.