Section 1 of 25

Why SLAT exists

Contents

A Tauri application starts small. There is a main.rs, a few #[tauri::command] functions, maybe a state.rs. Six months later the same project usually looks like this:

  • one or two enormous files hold "the commands", and the commands hold all of the business logic;
  • the application state is a struct with thirty fields, half of them Mutex<Option<…>> and AtomicBool;
  • a few static variables keep more state that nobody owns;
  • the domain logic calls app.emit(…) directly, so nothing can be tested without a window;
  • functions multiply into variants: start_with_budget, start_with_budget_and_slots, start_with_hook;
  • #[cfg(target_os = "macos")] is scattered across the codebase;
  • a new developer, or a coding agent, needs a day to find where a feature lives.

None of this is caused by bad people. It is caused by the absence of a shared answer to "where does this go?". When there is no answer, the nearest file wins, and the nearest file is always the biggest one.

SLAT gives that answer once, for every kind of code, and makes the important parts of it mechanical: the compiler and a handful of small scripts refuse code that breaks the layout, so the layout survives deadlines, new team members and coding agents.

SLAT is to a Rust backend what Nx with NgRx is to a front-end: a set of rules that is independent of any one application. We use it in every MonoOne product with a Rust and Tauri backend, including RigOne and IndexOne.

1.1. Goals

  1. Findability. A person or an agent who knows the name of a feature knows the folder it lives in, on both sides of the application.
  2. Testability without a window. Everything except the thin entry layer compiles and runs its tests without Tauri, without a display and without real processes.
  3. Boundaries the compiler enforces. Dependency direction is written in Cargo.toml, not in a wiki.
  4. One owner for long-lived state. Background work (a run, a recording, a conversation) has exactly one owner, and its rules are a pure function.
  5. Cheap growth. A new feature is a new folder with a fixed set of files, not edits to five shared files.
  6. Portability by construction. Code that depends on the operating system lives in one folder, so a new platform is a new file, not a search through the whole repository.

1.2. Non-goals

  • SLAT does not prescribe your front-end. It only fixes the contract at the boundary: commands, data transfer objects (DTOs) and events.
  • SLAT is not a framework. There is no crate to depend on. It is a layout, a set of rules and a few scripts.
  • SLAT does not replace your repository's own rules. When a project rule and SLAT disagree, the project rule wins. SLAT says where things live; the project says what is forbidden.

1.3. Who should use it

SLAT is designed for Rust desktop applications with Tauri, from about 10,000 lines of backend code upward. The ideas carry over to any Rust application with a thin entry layer (a CLI, a daemon, a server): replace "Tauri command" with "HTTP handler" or "CLI subcommand" and everything else holds.