A distributed, embeddable, reactive object database for .NET. Local-first persistence with mesh sync, LRU cache eviction, TTL enforcement, pluggable storage backends, and zero configuration.
πΏοΈ Built for developers who'd rather ship products than manage infrastructure.
dotnet add package AcornDB
dotnet add package AcornDB.Persistence.Cloud # Optional: S3, Azure Blob
dotnet add package AcornDB.Persistence.RDBMS # Optional: SQLite, SQL Server, PostgreSQL, MySQLMost apps don't need Cosmos DB, Kafka, or a $400/month cloud bill to store 5MB of JSON.
You need:
- β Fast, local-first persistence
- β Simple per-tenant or per-user storage
- β Offline support + sync that actually works
- β Zero configuration, zero ceremony
Perfect for:
- Desktop & mobile apps
- IoT & edge devices
- CLI tools & utilities
- Serverless & edge workloads
- Single-user SaaS apps
| Term | Description |
|---|---|
| Tree<T> | A collection of documents (like a table) |
| Nut<T> | A document with metadata (timestamp, version, TTL) |
| Trunk | Storage backend abstraction (file, memory, Git, cloud, SQL) |
| Branch | Connection to a remote Tree via HTTP |
| Tangle | Live sync session between two Trees |
| Grove | Container managing multiple Trees with unified sync |
| Acorn | Factory registry for discovering and creating trunks |
using AcornDB;
public class User
{
public string Id { get; set; } = Guid.NewGuid().ToString();
public string Name { get; set; }
}
// Create a tree (defaults to file storage, zero config!)
var tree = new Tree<User>();
// Or use the fluent builder pattern via Acorn
tree = new Acorn<User>().WithCompression().Sprout();
// Stash (auto-detects ID from property)
tree.Stash(new User { Name = "Alice" });
// Crack (retrieve)
var alice = tree.Crack("alice-id");
// Query with LINQ
var adults = tree.Nuts.Where(u => u.Age >= 18).ToList();Every Stash() creates a Git commit. Use Git tools to inspect your database:
using AcornDB;
using AcornDB.Storage;
var tree = new Acorn<User>()
.WithGitTrunk(repoPath: "./my_db", autoPush: true)
.Sprout();
tree.Stash(new User { Id = "alice", Name = "Alice" });
// β
Git commit created: "Stash: alice at 2025-10-07 10:30:45"
// Time-travel through history
var history = tree.GetHistory("alice"); // All previous versionscd my_db
git log --oneline
# f4e8a91 Stash: alice at 2025-10-07 10:30:45
# c2d1b3a Stash: bob at 2025-10-07 10:25:12Read More: GitHub Trunk Guide β
Discover and grow storage backends at runtime:
// Browse available storage types
Console.WriteLine(Nursery.GetCatalog());
// Grow trunk from config (no hardcoded dependencies!)
var tree = new Acorn<User>()
.WithTrunk("git", new()
{
{ "repoPath", "./my_repo" },
{ "authorName", "Alice" }
})
.Sprout();
// Change storage backend via environment variable
var storageType = Environment.GetEnvironmentVariable("STORAGE") ?? "file";
var tree = new Acorn<User>().WithTrunk(storageType).Sprout();// In-process sync (no HTTP server needed!)
var tree1 = new Acorn<User>().Sprout();
var tree2 = new Acorn<User>().InMemory().Sprout();
tree1.Entangle(tree2); // Direct tree-to-tree sync
tree1.Stash(new User { Name = "Bob" });
// β
Automatically synced to tree2!
// HTTP sync with TreeBark server
var branch = new Branch("http://localhost:5000");
grove.Oversee<User>(branch); // Auto-syncs on every changeRead More: Data Sync Guide β
| Feature | Description |
|---|---|
| π° Core API | Stash(), Crack(), Toss() - squirrel-style CRUD |
| π― Auto-ID Detection | Automatic ID extraction from Id or Key properties |
| π Reactive Events | Subscribe() for real-time change notifications |
| πͺ’ In-Process Sync | Direct tree-to-tree sync without HTTP |
| π HTTP Sync | TreeBark server for distributed sync |
| π‘οΈ Versioned Nuts | Timestamps, TTL, conflict detection built-in |
| βοΈ Conflict Resolution | Pluggable IConflictJudge<T> (timestamp, version, custom) |
| π§ LRU Cache | Automatic eviction with configurable limits |
| β° TTL Enforcement | Auto-cleanup of expired items |
| π² Grove Management | Multi-tree orchestration and sync |
| π AcornVisualizer | Web UI for browsing groves and nuts |
| πΏοΈ Git Storage | GitHubTrunk - every stash is a Git commit! |
| π± Nursery System | Dynamic trunk discovery and factory pattern |
| βοΈ Cloud Storage | S3, Azure Blob (via AcornDB.Persistence.Cloud) |
| πΎ RDBMS Storage | SQLite, SQL Server, PostgreSQL, MySQL (via AcornDB.Persistence.RDBMS) |
| π Encryption | AES encryption with password or custom provider |
| ποΈ Compression | Gzip/Brotli compression for storage optimization |
| π LINQ Support | GetAll() returns IEnumerable<T> for LINQ queries |
| π Full History | GetHistory(id) for version history (Git & DocumentStore trunks) |
| Feature | Target | Description |
|---|---|---|
| π BarkCodes Auth | v0.5 | Token-based authentication for sync |
| π Critters RBAC | v0.5 | Role-based access control |
| π Mesh Sync | v0.5 | Peer-to-peer multi-tree sync networks |
| π¦ CLI Tool | v0.5 | acorn new, acorn inspect, acorn migrate |
| π Auto-Recovery | v0.6 | Offline-first sync queue with retry |
| π Prometheus Export | v0.6 | OpenTelemetry metrics integration |
| π¨ Dark Mode UI | v0.6 | Canopy dashboard enhancements |
AcornDB uses Trunks to abstract storage. Swap backends without changing your code.
| Trunk | Package | Durable | History | Async | Use Case |
|---|---|---|---|---|---|
FileTrunk |
Core | β | β | β | Simple file storage (default) |
MemoryTrunk |
Core | β | β | β | Fast in-memory (testing) |
DocumentStoreTrunk |
Core | β | β | β | Versioning & time-travel |
GitHubTrunk |
Core | β | β | β | Git-as-database with commit history |
AzureTrunk |
Cloud | β | β | β | Azure Blob Storage |
S3Trunk |
Cloud | β | β | β | AWS S3, MinIO, DigitalOcean Spaces |
SqliteTrunk |
RDBMS | β | β | β | SQLite database |
SqlServerTrunk |
RDBMS | β | β | β | Microsoft SQL Server |
PostgreSqlTrunk |
RDBMS | β | β | β | PostgreSQL |
MySqlTrunk |
RDBMS | β | β | β | MySQL/MariaDB |
Read More: Storage Guide β Cloud Storage Guide β Nursery Guide β
using AcornDB;
// File storage (default)
var tree = new Acorn<User>().Sprout();
// Git storage
var gitTree = new Acorn<User>()
.WithGitTrunk("./my_repo", authorName: "Alice")
.Sprout();
// With encryption + compression
var secureTree = new Acorn<User>()
.WithEncryption("my-password")
.WithCompression()
.Sprout();
// LRU cache with limit
var cachedTree = new Acorn<User>()
.WithLRUCache(maxSize: 1000)
.Sprout();
// Via Nursery (dynamic)
var dynamicTree = new Acorn<User>()
.WithTrunk("git", new() { { "repoPath", "./data" } })
.Sprout();using AcornDB.Persistence.Cloud;
using AcornDB.Persistence.RDBMS;
// S3 storage
var s3Tree = new Acorn<User>()
.WithS3Trunk(accessKey, secretKey, bucketName, region: "us-east-1")
.Sprout();
// Azure Blob
var azureTree = new Acorn<User>()
.WithAzureBlobTrunk(connectionString, containerName)
.Sprout();
// SQLite
var sqliteTree = new Acorn<User>()
.WithSqliteTrunk("Data Source=mydb.db")
.Sprout();
// PostgreSQL
var pgTree = new Acorn<User>()
.WithPostgreSQLTrunk("Host=localhost;Database=acorn")
.Sprout();- Getting Started Guide - Your first AcornDB app
- Core Concepts - Understanding Trees, Nuts, and Trunks
- Storage Guide - Available trunk types and usage
- Data Sync Guide - In-process, HTTP, and mesh sync
- Conflict Resolution - Handling sync conflicts
- Events & Reactivity - Real-time change notifications
- GitHub Trunk Demo - Git-as-database guide
- Nursery Guide - Dynamic trunk discovery
- Cloud Storage Guide - S3, Azure Blob setup
- Dashboard & Visualizer - Web UI for grove management
- Cluster & Mesh - Distributed sync patterns
// Example 1: Local-first desktop app
var tree = new Acorn<Document>()
.WithStoragePath("./user_data")
.WithLRUCache(5000)
.Sprout();
tree.Subscribe(doc => Console.WriteLine($"Changed: {doc.Title}"));
// Example 2: IoT edge device with cloud backup
var edgeTree = new Acorn<SensorReading>()
.WithStoragePath("./local_cache")
.Sprout();
var cloudBranch = new Branch("https://api.example.com/sync");
grove.Oversee<SensorReading>(cloudBranch); // Auto-syncs to cloud
// Example 3: Multi-tenant SaaS with per-tenant storage
string GetTenantPath(string tenantId) => $"./data/{tenantId}";
var tenantTree = new Acorn<Order>()
.WithStoragePath(GetTenantPath(currentTenantId))
.Sprout();
// Example 4: Git-based audit log
var auditLog = new Acorn<AuditEntry>()
.WithGitTrunk("./audit_log", authorName: "System")
.Sprout();
auditLog.Stash(new AuditEntry { Action = "Login", User = "alice" });
// Git commit created with full history!More Examples: Demo Project β Live Sync Demo β
Explore your Grove with an interactive dashboard:
cd Canopy
dotnet run
# Open http://localhost:5100Features:
- π Real-time statistics
- π³ Tree explorer with metadata
- π Interactive graph visualization
- π Nut inspector with history
- βοΈ Trunk capabilities viewer
Read More: Dashboard Guide β
| Project | Purpose |
|---|---|
AcornDB |
Core library (Tree, Nut, Trunk, Sync) |
AcornDB.Persistence.Cloud |
S3, Azure Blob, cloud storage providers |
AcornDB.Persistence.RDBMS |
SQLite, SQL Server, PostgreSQL, MySQL |
AcornDB.Sync |
TreeBark - HTTP sync server |
AcornDB.Canopy |
Web UI dashboard |
AcornDB.Demo |
Example applications |
AcornDB.Test |
Test suite (100+ tests) |
AcornDB.Benchmarks |
Performance benchmarks |
πΏοΈ Serious software. Zero seriousness.
We built AcornDB because we were tired of:
- Paying $$$ to store JSON
- Managing Kubernetes for simple persistence
- Writing
DataClientServiceManagerFactoryFactory - YAML-induced existential dread
We believe:
- Developers deserve tools that make them smile
- Syncing JSON shouldn't require a PhD
- Local-first is the future
- API names should be memorable (
Stash,Crack,Shake>Insert,Select,Synchronize)
If you've ever rage-quit YAML or cried syncing offline-first apps β welcome home. π³
We welcome contributions! Check out:
Built with acorns and sarcasm by developers who've had enough.
β Star the repo if AcornDB saved you from another cloud bill π΄ Fork it if you want to get squirrelly π¬ Share your weirdest squirrel pun in the discussions
AcornDB is source-available software provided by Anadak LLC.
- Free for personal, educational, and non-commercial use under the
PolyForm Noncommercial License 1.0.0 - Commercial use requires a separate license from Anadak LLC. The cost of which will be inversely proportionate to the degree of good you're doing. Contact licensing@anadak.ai for details.
Β© 2025 Anadak LLC. All rights reserved.