Skip to main content

Crate grounddb

Crate grounddb 

Source
Expand description

§GroundDB

A schema-driven data layer that uses Markdown files as the source of truth.

GroundDB stores data as plain Markdown files with YAML front matter, organized on disk by configurable path templates. A SQLite system database keeps an index for fast queries, and SQL-defined views are maintained automatically.

§Core concepts

  • Collections — folders of Markdown files, each file is a document
  • Schema — a schema.yaml defining collections, fields, types, and views
  • Path templates — map field values to filesystem paths (e.g., posts/{status}/{date}-{title}.md)
  • Views — SQL queries over collections, maintained incrementally from the document index
  • System database — a SQLite file (_system.db) storing the document index, view cache, and schema history

§Usage

use grounddb::Store;

let store = Store::open("data").unwrap();

// Access a collection
let users = store.collection("users").unwrap();
let docs = users.list().unwrap();

For compile-time typed access, use grounddb-codegen to generate Rust structs from your schema.

§Feature highlights

  • Schema validation with enums, defaults, and required fields
  • Referential integrity (error, cascade, nullify, archive)
  • Auto-generated IDs (ulid, uuid, nanoid)
  • Atomic file writes and batch operations with rollback
  • Incremental boot with directory-hash change detection

Re-exports§

pub use error::GroundDbError;
pub use error::Result;
pub use schema::SchemaDefinition;
pub use store::Store;
pub use store::Collection;
pub use store::Batch;
pub use store::SubscriptionId;
pub use store::ChangeEvent;
pub use document::Document;
pub use view::ViewEngine;

Modules§

document
error
migration
path_template
schema
store
system_db
util
validation
view
watcher