A single-file embedded database for C# apps. Mainframe-inspired direct addressing, familiar SQL syntax, and production-grade replication — without the operational weight of MongoDB.
Three designs coexisted for thirty years: SQLite for embedded relational data, MongoDB for JSON at scale, and the venerable mainframe TPF systems running airline reservations. DocumentForge takes the best of each and ships as a single .NET library.
Write SELECT * FROM orders WHERE passenger.lastName = 'Smith'. JOINs, GROUP BY, aggregations, composite indexes — the syntax every developer already knows.
Direct-address location map means every document has a known physical address. 210,000 QPS for indexed point lookups on a single laptop, even at 10M docs.
db.Collection<Order>("orders").Where(o => o.Pnr == "ABC").FirstOrDefault(). Strongly typed, captured variables work, no SQL strings required.
Write-ahead recovery log with CRC32 per record. Per-page checksums detect silent corruption. Crash recovery on every restart.
Logical replication with sequence numbers and catchup. Follower auto-promotes on leader silence. Planned handover for zero-data-loss datacenter moves.
Scale horizontally across N nodes. Online rebalance with zero downtime — clients read and write throughout the migration. Add or drop shards safely.
Open a file, insert a JSON document, run a SQL query. There is no server to install, no connection string to configure, no schema to migrate.
using DocumentForge.Engine; // Open or create a database file using var db = DocumentForgeDb.OpenOrCreate("airline.dfdb"); // Insert a document db.Insert("orders", @"{ ""pnr"": ""ABC123"", ""passenger"": { ""lastName"": ""Smith"" }, ""flights"": [{ ""flightNumber"": ""AA100"" }] }"); // Create indexes db.CreateIndex("orders", "pnr", "idx_pnr", unique: true); db.CreateIndex("orders", "passenger.lastName", "idx_ln"); // Query with SQL var result = db.Execute("SELECT * FROM orders WHERE pnr = 'ABC123'"); Console.WriteLine(result.Documents[0].ToJson());
A laptop comfortably holds 10 million documents with five indexes, sustaining 40,000+ inserts per second and 160,000+ indexed reads per second — verified in the included benchmark. Sharding extends this linearly across commodity nodes. Online rebalance moves data between shards while clients keep reading and writing.
DocumentForge isn't trying to be the biggest database. It's trying to be the one you reach for when you want JSON flexibility, SQL familiarity, and an operational footprint that fits in your head.
Add to any .NET 9 project. Open a file, start querying. No external dependencies.
dfdb serve stands up a node per shard with one command. JSON-in/JSON-out. Each node reads a small node.json config (or takes CLI flags).
One self-contained executable with every feature: serve, query, repl, cluster, health, rebalance, seed. Ships as a 47 MB file with the runtime bundled — no .NET required on the target machine.
Separate Next.js app. Dashboard, query console, collections browser, cluster topology builder — no command line required.
dfdb binary, a Next.js admin UI, and ten documentation pages (including a full CLI reference). Use it for embedded scenarios, prototypes, small-to-medium production workloads, and understanding how databases actually work.