ferrite_db runs as a standalone server that clients connect to over TCP. It is a one-person project, started as a way to learn Rust, and it is still a work in progress.
$ cargo install ferrite_db $ ferrite_db # 127.0.0.1:7878, data in ./ferrite_data $ nc 127.0.0.1 7878 {"cmd":"use","db":"shop"} {"cmd":"insert","collection":"users","doc":{"name":"Dylan","age":25,"address":{"city":"Leeds"}}} {"cmd":"find","collection":"users","filter":{"age":{"$gt":18}},"sort":{"age":-1},"limit":10}
$, $[] and $[name] with arrayFilters.$match, $group, $project, $lookup (also with let and a sub-pipeline), $unwind, $facet, $bucket, $bucketAuto, $graphLookup, $out, $merge and more.
Equality, range, compound and unique. A sort with a limit is read straight off the index.
Watch with a $match pipeline, and resumeAfter tokens.
One leader, with followers that copy its log byte for byte. Followers serve reads and watch and refuse writes. There is no automatic failover, and you promote a follower by hand.
JSON lines (so nc works) or a binary format, picked by the first byte of the connection. The binary format is not BSON.
A .deb with a systemd unit and /etc/ferrite/ferrite.conf, plus an install.sh. A memory limit defaults to 70% of RAM or the cgroup limit.
One run on one machine, 100,000 small documents, MongoDB's normal settings. With every write fsynced, MongoDB is faster.
TypeScript first, with no runtime dependencies. Schemas, types inferred from the schema, hooks, populate and timestamps.
import { connect, model, t, type Infer } from "ferrite-db"; const User = model("users", { name: t.string(), email: t.string().unique(), age: t.int().optional(), tags: t.array(t.string()), }); const db = await connect("ferrite://root:pw@localhost/shop"); await User.create({ name: "Ada", email: "[email protected]", tags: ["admin"] }); const adults = await User.find({ age: { $gt: 18 } }).sort({ name: 1 }).limit(10);
A Tauri 2 app for browsing, editing, indexes, aggregate, users and grants. It keeps connection passwords in the system keychain and works over TLS. It is a separate repo, installed per user with install.sh or as a .deb.
FerriteDB is a learning project and has had one review. It is not production ready.
All data lives in RAM, so the ceiling is about 2.5M typical documents in 2 GB.
There is no failover. Three known gaps: a follower deletes databases the leader lacks, a resync reads empty meanwhile, and resume has no log id.
There are no drivers except the npm package, and no query planner.
It is not wire-compatible with MongoDB, so MongoDB drivers will not connect.
The memory limit is Linux only.