Introducing Joydb: A Tiny Embedded Database for Rust Prototypes
Serhii Potapov April 21, 2025 #rust #database #prototypingHi, and I’d like to introduce you to Joydb, a small open-source crate I created to solve a recurring problem I ran into while building side projects and prototypes in Rust.
Joydb is an in-memory embedded database with simple persistence and a minimal, ORM-like API. It’s intentionally lightweight and focused on one thing: making prototyping and quick experiments as smooth and joyful as possible.
Why Joydb?
When building something new, I often need a bit of persistent state — just enough to test an idea or build out a feature. But setting up a full database like PostgreSQL or SQLite always feels like overkill.
So, I’d fall back to writing data into a JSON file manually. It worked, but it was tedious and error-prone.
Eventually, I decided to build something better — a tiny database that’s super easy to use, flexible enough for quick storage, and doesn’t get in the way. That’s how Joydb came to life.
What Joydb Offers
Joydb lets you:
- Define your models using
serde
- Store them in memory
- Persist them to disk using a plug-and-play adapter
- Perform basic CRUD operations (see docs)
All with minimal setup and maximum ergonomics.
Quick Example
Here’s a simple example of using Joydb to store and retrieve users:
use ;
use ;
state!
type Db = ;
let db = open.unwrap;
let alice = User ;
db.insert.unwrap;
let user = db..unwrap.unwrap;
assert_eq!;
That’s it. No schema, no migrations, no setup. Just open the DB and go.
Storage Adapters
Joydb includes built-in adapters for JSON, RON, and CSV formats. You can choose whether you want to persist everything in a single file or split it across multiple files.
And if none of the provided adapters fit your use case, the good news is: you can easily implement your own.
Limitations (and Why That’s Okay)
Joydb keeps everything in memory and writes the whole state to disk at once. That means it’s not suitable for production, large data sets, or high-performance use cases.
And that’s by design. It’s a tool for hacking, learning, testing, and prototyping — not for scaling.
If your project starts to grow beyond that scope, it’s time to switch to a real database before Joydb turns into Paindb 😅
Inspired By
Joydb takes inspiration from tools like:
I wanted to bring a similar level of simplicity and joy to the Rust ecosystem.
Try It Out
Joydb is open source and available on GitHub and crates.io.
Happy prototyping!
— Serhii