Getting started
Installation
From docs/installation.md at commit 548821a.
Spinto 0.1.0. These docs follow the main branch. Spinto isn't on crates.io yet, so you install it from a clone.
- Requirements
- Adding Spinto to an application
- Letting people in
- Configuration
- Trying it with the example application
Requirements
- A Laravel for Rust application on
laravel-rust0.1.4 or later. - The
databaseworkflow store. Spinto lists runs by reading its tables; with thememorystore it can still open one run by its ID. - Node.js 22 to build Spinto’s frontend, once.
Adding Spinto to an application
Spinto isn’t on crates.io yet. Until it is, add it from a local clone with its frontend built, because the crate embeds the built dist/ folder when it compiles:
git clone https://github.com/sifrious/spinto.git ../spinto
cd ../spinto && npm ci && npm run build
Then depend on that clone:
# Cargo.toml
[dependencies]
spinto = { path = "../spinto" }
And register the provider in your application’s builder:
// src/app.rs
use crate::http::spinto_access::SpintoAccess;
Application::configure()
.with_providers(|providers| {
providers.add(spinto::Spinto::new().authorize(SpintoAccess));
})
Then run your application’s migrations. Spinto registers two tables of its own, for the job attempts and worker check-ins it records (see Observations):
cargo run -- migrate
Spinto’s pages are now at /spinto, for the people SpintoAccess lets in.
Letting people in
Spinto refuses every request until you tell it who may look. Implement spinto::Authorize; it gets the request and answers yes or no:
// src/http/spinto_access.rs
use laravel::http::Request;
use crate::models::User;
pub struct SpintoAccess;
impl spinto::Authorize for SpintoAccess {
async fn authorize(&self, request: &Request) -> laravel::Result<bool> {
let user: Option<User> = request.user().await?;
Ok(user.is_some_and(|user| user.email.ends_with("@example.com")))
}
}
A guest is sent to your login page, if you marked one, and everyone else gets a 403. The security guide covers what Spinto redacts and how its pages are protected.
To show a check’s result beside each run, such as “the welcome pack builds within 10 seconds”, declare expected behaviors with .expect(..). See Expected behaviors.
Configuration
Spinto reads its settings from the environment:
| Variable | Default | What it does |
|---|---|---|
SPINTO_PATH |
/spinto |
Where the pages are served |
SPINTO_ENABLED |
true |
Turns the pages off without removing the provider |
SPINTO_PAYLOADS |
redacted |
redacted shows payloads with secrets hidden; hidden shows none |
SPINTO_REDACT_KEYS |
none | More JSON keys to redact, comma-separated |
SPINTO_PAYLOAD_LIMIT |
65536 |
Payloads larger than this many bytes are cut |
SPINTO_POLL_SECONDS |
5 |
How often open pages re-read the store |
SPINTO_MCP_TOKEN |
none | Turns on the HTTP MCP endpoint for agents holding this token |
SPINTO_CLOUD_URL |
none | Your environment’s page in Laravel Cloud, for links to Cloud |
SPINTO_TRACE_URL |
none | Your trace viewer’s page for one trace, with {trace_id} where the ID goes, for trace links |
SPINTO_RETENTION_DAYS |
7 |
How many days of job attempts and worker check-ins Spinto keeps |
Spinto refuses to boot with a setting it can’t follow, such as an unknown payload policy, a path without a leading /, or a Cloud URL that isn’t https, and says which one. It warns when the MCP token is short enough to guess.
Trying it with the example application
The repository includes examples/onboarding, a Laravel for Rust application with a customer-onboarding workflow that retries, sleeps, waits for an approval and builds a welcome pack. With PostgreSQL running:
npm ci && npm run build
cargo build
cd examples/onboarding
cp .env.example .env # then set DATABASE_URL
../../target/debug/onboarding key:generate # sets APP_KEY, which sessions need
../../target/debug/onboarding migrate
../../target/debug/onboarding db:seed # prints the demo operator's password
../../target/debug/onboarding queue:work &
../../target/debug/onboarding demo:start --failures 2 --pack-seconds 20
../../target/debug/onboarding serve
Open http://127.0.0.1:8000/spinto and sign in as ops@spinto.test with the password db:seed printed.
The run stops at once to wait for an approval. Approve customer 1, the customer demo:start printed, from another terminal in examples/onboarding:
../../target/debug/onboarding demo:approve 1
The run then fails to provision twice, retries, builds the welcome pack for 20 seconds, sleeps through a 10-second cooling-off period and completes. demo:approve 1 --reject rejects the customer instead.
To fill a database of its own with every state Spinto shows (a run in each status, a batch import with a failing part, and a run whose worker is killed mid-step), run one script from the repository root. It takes everything but DATABASE_URL from the example’s .env above, APP_KEY included. It migrates and seeds the database, leaves the evidence in the directory you name, and serves the dashboard until you press Ctrl-C:
DATABASE_URL=postgres://127.0.0.1/spinto_demo scripts/demo/launch.sh ~/spinto-demo