Section 5 of 25
Tiers
Contents
A SLAT workspace has at most five kinds of crates. They are named <product>-<tier>, for example quayside-core.
| Tier | What lives here | May depend on | Never |
|---|---|---|---|
kit |
Shared types and tools without a domain: identifiers, time, paths (kit::paths), durable file writes, the base error type, logging. |
external libraries only | tauri, tokio::process, SQL, operating-system #[cfg], anything from the product |
store |
Persistence: the writing connection and the read connections, migrations, schema, index rebuild, database encryption. | kit |
tauri, domain logic, processes |
drivers |
The outside world: processes, provider command-line tools, HTTP, sidecars. Code that depends on the operating system lives only in drivers/src/platform/. |
kit |
tauri, store, domain logic |
core |
All domain slices: model, logic, use cases, actors. | kit, store, drivers |
tauri |
app |
Entries: Tauri commands, DTOs, events, entry servers (MCP, bridge), the application state, setup, main. |
every other tier | domain logic (that belongs in core) |
In this document core/… and app/… are short for the two crates' source folders. core/src/<slice>/ is crates/<product>-core/src/<slice>/, and app/src/<slice>/ is src-tauri/src/<slice>/, the folder Tauri creates for the app crate. The checks in section 16 use the full paths.
The shape of a SLAT workspace: Quayside, the example application from section 20, after its migration, shortened to two slices and four checks. Section 20.4 lists all of its slices.
quayside/
├── Cargo.toml
├── package.json
├── docs/
│ └── slat/
│ └── SLAT.md
├── checks/
│ ├── baselines/
│ │ └── emit.txt
│ ├── slat-commands.sh
│ ├── slat-emit.sh
│ ├── slat-platform.sh
│ └── slat-pure-update.sh
├── crates/
│ ├── quayside-kit/
│ │ ├── Cargo.toml
│ │ └── src/
│ │ ├── lib.rs
│ │ ├── ids.rs
│ │ ├── paths.rs
│ │ ├── durable_file.rs
│ │ └── jobs.rs
│ ├── quayside-store/
│ │ ├── Cargo.toml
│ │ └── src/
│ │ ├── lib.rs
│ │ ├── writer.rs
│ │ ├── schema.rs
│ │ └── migrations/
│ ├── quayside-drivers/
│ │ ├── Cargo.toml
│ │ └── src/
│ │ ├── lib.rs
│ │ ├── whisper.rs
│ │ ├── recorder.rs
│ │ └── platform/
│ │ ├── mod.rs
│ │ ├── unix.rs
│ │ ├── macos.rs
│ │ └── unsupported.rs
│ └── quayside-core/
│ ├── Cargo.toml
│ ├── src/
│ │ ├── lib.rs
│ │ ├── recording/
│ │ │ ├── mod.rs
│ │ │ ├── model.rs
│ │ │ ├── logic.rs
│ │ │ ├── service.rs
│ │ │ └── actor/
│ │ │ ├── mod.rs
│ │ │ ├── msg.rs
│ │ │ ├── state.rs
│ │ │ ├── update.rs
│ │ │ ├── effect.rs
│ │ │ ├── run.rs
│ │ │ ├── handle.rs
│ │ │ └── snapshot.rs
│ │ └── transcript/
│ │ ├── mod.rs
│ │ ├── model.rs
│ │ ├── logic.rs
│ │ ├── store.rs
│ │ └── service.rs
│ └── tests/
│ └── it/
│ ├── main.rs
│ └── recording_stops_on_time_limit.rs
├── src-tauri/
│ ├── Cargo.toml
│ ├── tauri.conf.json
│ └── src/
│ ├── main.rs
│ ├── lib.rs
│ ├── state.rs
│ ├── error.rs
│ ├── recording/
│ │ ├── mod.rs
│ │ ├── commands.rs
│ │ ├── dto.rs
│ │ └── events.rs
│ └── transcript/
│ ├── mod.rs
│ ├── commands.rs
│ └── dto.rs
└── src/
└── sections/
├── recording/
└── transcript/
5.1. The compiler is the guard
The arrows between tiers are written in each crate's Cargo.toml. If core does not list tauri as a dependency, then use tauri::Manager; inside core is a compile error. That is the strongest guarantee a rule can have: it cannot be forgotten, skipped in review or argued with.
A minimal workspace:
Cargo.toml:
[workspace]
resolver = "3"
members = ["crates/*", "src-tauri"]
[workspace.dependencies]
tokio = { version = "1", features = ["rt-multi-thread", "macros", "sync", "time"] }
serde = { version = "1", features = ["derive"] }
thiserror = "2"
crates/quayside-core/Cargo.toml:
[package]
name = "quayside-core"
version = "0.1.0"
edition = "2024"
[dependencies]
quayside-kit = { path = "../quayside-kit" }
quayside-store = { path = "../quayside-store" }
quayside-drivers = { path = "../quayside-drivers" }
tokio.workspace = true
serde.workspace = true
thiserror.workspace = true
src-tauri/Cargo.toml:
[package]
name = "quayside"
version = "0.1.0"
edition = "2024"
[lib]
name = "quayside_lib"
[dependencies]
quayside-core = { path = "../crates/quayside-core" }
quayside-store = { path = "../crates/quayside-store" }
quayside-kit = { path = "../crates/quayside-kit" }
tauri = { version = "2", features = [] }
5.2. How many crates to start with
The minimum is two: core and app. Split out the other tiers only when their code already exists and is clean, which means it imports nothing from a higher tier. An empty crate "for later" is forbidden. It costs a compiler run on every build and its own test binaries to link on every test run, and teaches nothing.
5.3. When to split a tier
When core grows past about 60,000 lines, or a full rebuild of core after a change to one slice becomes painful, move a group of slices into core-<group>, for example quayside-core-run. Stay at six to eight crates at most. A library crate is not linked, but each crate brings its own test binaries, and each of those is linked separately (section 22.1). On a laptop a frozen machine costs more than the seconds a finer split would save. Decide with a measurement, not a feeling: cargo build --timings shows whether core is really the bottleneck (section 22.6).
Split by compile weight, not only by lines. A driver that wraps a large native or machine-learning library (speech recognition, an inference runtime, a database compiled from C sources) is often heavier than Tauri itself. Inside drivers it would be compiled and linked into every test binary of core, because core depends on drivers. Give such a driver its own crate, <product>-drivers-<name>, that core does not depend on. app depends on it and hands its output to the slice through a data seam (14.2), or the driver runs as a separate helper process that app starts. The tests of core then never compile it. cargo-deny keeps it that way: { crate = "quayside-drivers-speech", wrappers = ["quayside"] } in deny.toml (16.5) makes any other path to that crate red.
5.4. Compatibility exception
A library name that the Tauri bundler or the user's data already knows (for example quayside_lib, or a folder under the user's home directory) stays with the app crate. New crates get new names.