whatisgithub

What is sled?

spacejam/sled — explained in plain English

Analysis updated 2026-06-24

8,988RustAudience · developerComplexity · 2/5Setup · easy

In one sentence

Sled is an embedded key-value database for Rust apps, no separate server, no SQL schema, just open a file and read or write keys with transactions, range scans, and real-time change watchers.

Mindmap

mindmap
  root((sled))
    What it does
      Embedded key-value store
      No server required
    Features
      Transactions
      Range scans
      Real-time change watching
    Performance
      Lock-free concurrency
      Flash storage optimized
      Crash-safe writes
    Tech Stack
      Pure Rust library
      Rust package registry
Click or tap to explore — scroll the page freely

Code map

Detail Auto

An interactive map of this repo's files and how they connect — its source is parsed live in your browser. Click Visualize to build it.

filefunction / class

What do people build with it?

USE CASE 1

Add persistent key-value storage to a Rust application without setting up or connecting to a database server.

USE CASE 2

Build a local-first app that stores user data with crash-safe writes and automatic background flushing to disk.

USE CASE 3

Scan a range of keys in sorted order to implement prefix search or paginated listings inside a Rust service.

What is it built with?

Rust

How does it compare?

spacejam/sledwasm-bindgen/wasm-bindgenccfddl/ccf-deadlines
Stars8,9888,9898,990
LanguageRustRustRust
Setup difficultyeasymoderateeasy
Complexity2/53/51/5
Audiencedeveloperdeveloperresearcher

Figures from each repo's GitHub metadata at analysis time.

How do you get it running?

Difficulty · easy Time to first run · 30min

Note: the main branch currently contains a large in-progress rewrite, so documented behavior may not match the latest code.

License terms are not specified in the project explanation, check the repository directly for license details.

So what is it?

Sled is an embedded database written in Rust, meaning it runs inside your application rather than as a separate server you connect to. You store and retrieve data using keys and values, similar to a dictionary or a sorted map. There is no SQL, no schema to define upfront, and no separate database process to manage. You open a database file, read and write keys, and the library handles the rest. The API is designed to feel familiar to anyone who has used a sorted map in any programming language. You can insert a key-value pair, look it up, delete it, scan a range of keys in order, or watch for changes on a set of keys in real time. Sled also supports transactions, which let you read and write multiple keys together as a single all-or-nothing operation. On the reliability side, sled automatically flushes data to disk roughly every 500 milliseconds by default, so you do not lose much work if the process crashes. You can also trigger a flush manually if you need stronger guarantees. The storage engine is built with crash safety in mind, and the project uses fuzzing and formal methods to test correctness under failure scenarios. Performance is a stated goal. The internals use lock-free data structures so that multiple threads can read and write concurrently without blocking each other. The storage format is optimized for flash storage and compresses repeated key prefixes to reduce disk usage. The README notes that the main branch currently contains a large in-progress rewrite, so the documented behavior may not match the latest code exactly. The library is open source and available through the standard Rust package registry.

Copy-paste prompts

Prompt 1
Show me how to open a sled database in Rust, insert 10 key-value pairs, and scan them back in sorted order.
Prompt 2
Help me implement a sled transaction in Rust that atomically transfers a balance between two keys and rolls back on any error.
Prompt 3
Write a Rust function that uses sled's subscriber to watch a set of keys and print each change as it happens in real time.
Prompt 4
How do I configure sled's background flush interval in Rust and manually flush all pending writes before a graceful shutdown?
Prompt 5
Show me how to use sled's compare-and-swap operation to safely update a counter value in a concurrent Rust application.

Frequently asked questions

What is sled?

Sled is an embedded key-value database for Rust apps, no separate server, no SQL schema, just open a file and read or write keys with transactions, range scans, and real-time change watchers.

What language is sled written in?

Mainly Rust. The stack also includes Rust.

What license does sled use?

License terms are not specified in the project explanation, check the repository directly for license details.

How hard is sled to set up?

Setup difficulty is rated easy, with roughly 30min to a first successful run.

Who is sled for?

Mainly developer.

Open on GitHub → Ask about another repo

This repo across BitVibe Labs

Verify against the repo before relying on details.