Skip to content

About

A zero-dependency Rust NoSQL database with an embedded, crash-safe storage engine and atomic transactions across key-value, document, graph, and time-series data, plus full-text and vector search, and a network server and client.

Topics

Resources

Contributing

Security policy

Stars

1 star

Watchers

0 watching

Forks

Repository files navigation

softshellDB

softshellDB is an embedded NoSQL database engine written in Rust. It stores key-value pairs, JSON-like documents, and property graphs in one crash-safe storage engine, and one transaction can insert a document with its index entries, add a graph edge, and update a key, atomically. A command-line tool, softshell, inspects and maintains a database.

It is built from the ground up, with no third-party crates and no unsafe code: its storage engine, codecs, compression, indexes, and test tools are all in this repository, and it reaches the operating system only through Rust's standard library.

Status

Milestone M0, foundation and guardrails. The design and the plan were written again on December 2, 2026, after the earlier code was removed. Roadmap tasks M0.1 through M0.7, M1.1, M1.2, M1.5, and M2.1 through M2.3 are ticked: the workspace's 13 crates build, pinned to Rust 1.100.1, with no third-party crates and no unsafe code. The foundation crate, softshell-core, has every module its spec plans: checked byte readers, varints, errors, limits, CRC-32C checksums, hashes, a seeded random number generator, time-ordered IDs, time, logging, metrics, a command-line parser, and a property-test harness. The codec crate, softshell-codec, has the value model, the JSON and JSONC parsers and writers, SDOC, the binary format stored documents use, keycode, the key encoding whose byte order is value order, and SLZ, the block compression format, each binary format with fixtures that its tests read on every run. cargo xtask ci runs the nine guardrail checks: formatting, Clippy, the docs, the tests, dependencies, crate layering, license headers, unsafe code, and the feature list. The fuzzer, softshell-fuzz, feeds mutated input to the JSON and JSONC parsers and the SDOC, keycode, and SLZ decoders for a set time, through cargo xtask fuzz-smoke. The platform crate, softshell-platform, has the Vfs trait, the one file interface the storage engine will use, with an in-memory implementation, an implementation over the real filesystem on Linux, and a conformance suite that both pass. On Linux it also reads OS randomness for IDs. For crash tests, it has FaultVfs, which simulates a power loss by keeping only what was synced, and makes chosen file operations fail. The other crates are still stubs. M0.8, the CI workflow on four runners, waits on its first run from a pull request, and M0.9, which publishes the crate names on crates.io, waits on the maintainer. M1.3 and M1.4, the real filesystem on macOS and Windows, wait on M0.8. The next task is M2.4, record framing for the write-ahead log and the manifest. The design, the decisions behind it, and the task-by-task plan are in docs/:

Progress is ticked task by task in docs/roadmap.md.

What it will look like

use softshelldb::prelude::*;

fn main() -> Result<(), softshelldb::Error> {
    let db = Database::open("./data", Options::default())?;

    db.write(|tx| {
        tx.create_collection("notes", CollectionOptions::default())?;
        tx.collection("notes")?.insert(value!({
            "title": "Tide tables",
            "tags": ["ocean"],
            "body": "Low tide is the best time to explore tide pools.",
        }))?;
        Ok(())
    })?;

    let ocean_notes = db.read(|rx| {
        rx.collection("notes")?
            .find(query!({ "tags": "ocean" }))?
            .collect_values()
    })?;
    Ok(())
}

This is a sketch from the design; the API will change as it is built.

Plan at a glance

Milestone Delivers
M0 Workspace, foundation crate, JSON, guardrail checks, fuzzer, and CI
M1 Durable file I/O on Linux, macOS, and Windows; a fault-injecting filesystem
M2 Binary formats: SDOC documents, order-preserving keys, compression, and log framing
M3–M4 The LSM storage engine, crash tests, compaction, caches, and benchmarks
M5 Serializable transactions and the key-value API
M6 Documents: collections, queries, updates, and secondary indexes
M7 Graphs, and one transaction across all three models
M8 Hardening and the first release

Design principles

  • Never lose an acknowledged commit. Every record and block is checksummed; a commit is acknowledged as durable only after its log record is synced; crash tests simulate power loss at every sync point.
  • Hostile input never crashes it. Every decoder is bounded and fuzzed.
  • One engine, three models. Each data model is a library over the same transactions; the facade glues them together.
  • No unsafe code. Every crate forbids it, and the engine reaches the OS only through Rust's standard library.
  • Build first. No third-party crates unless one is impossible to avoid (a cryptography library, for example) and the maintainer approves it (dependency policy).

Platforms

Linux (x86_64 and aarch64), macOS 13 or later on Apple Silicon, and Windows 10 or later (x86_64), on local filesystems (details).

Contributing

See CONTRIBUTING.md. Coding agents follow AGENTS.md; Claude Code also reads CLAUDE.md.

Security

Report vulnerabilities privately, as SECURITY.md describes.

License

Apache-2.0. See LICENSE and NOTICE.

About

A zero-dependency Rust NoSQL database with an embedded, crash-safe storage engine and atomic transactions across key-value, document, graph, and time-series data, plus full-text and vector search, and a network server and client.

Topics

Resources

Contributing

Security policy

Stars

1 star

Watchers

0 watching

Forks

Releases

Packages

Used by

Contributors

Languages