Joydb
An in-memory embedded database with persistence and multiple adapters (JSON, CSV, etc).
Acts like a minimalistic ORM with zero setup.
Simple, lightweight, and perfect for prototypes, small apps, or experiments.
Get started
use joydb::{Joydb, Model, adapters::JsonAdapter};
use serde::{Deserialize, Serialize};
#[derive(Debug, Clone, Serialize, Deserialize, Model)]
struct User {
id: u32,
name: String,
}
#[derive(Debug, Clone, Serialize, Deserialize, Model)]
struct Post {
id: u32,
title: String,
}
joydb::define_state! {
AppState,
models: [User, Post],
}
type Db = Joydb<AppState, JsonAdapter>;
fn main() -> Result<(), Box<dyn std::error::Error>> {
let db = Db::open("data.json")?;
db.insert(&User {
id: 1,
name: "Alice".to_owned(),
})?;
let alice = db.find::<User>(&1)?.unwrap();
assert_eq!(alice.name, "Alice");
}
Similar projects
- lowdb - JSON database for JavaScript
- alkali - Python ORM that writes to disk (JSON, YAML, CSV, etc)