Educational project

KantanDB

I am building the same small JSON document database in more than one language. The Go version comes first. A Rust port will follow once the design settles, and other versions may come later.

Holding the database behavior steady makes the implementation differences easier to study. Each port is a practical exercise in a language rather than a new database design.

This is an experiment, not a production database.

Shared across implementations

Database design

These are the intended user-visible rules. Implementation details belong to each language version.

Databases and documents

KantanDB groups JSON documents into named databases. A document is always a JSON object. The server assigns its permanent ID and keeps a revision that changes after every update.

Clients can create, read, replace, patch, and delete documents. They can include the revision with a change so that an older copy cannot accidentally overwrite a newer one.

Indexes and queries

A database may define indexes over fields used often in queries. Queries can test scalar values for equality or compare numbers and strings by order.

JSONPath handles queries that do not fit a declared index. Query results contain document IDs and are split into pages. A cursor continues the same query from the previous page.

Persistence and limits

A successful write survives a restart. A document and its index entries change together, so a query does not see half of an update.

Requests and query work have fixed bounds. An expensive query stops instead of consuming unlimited time or memory.

Document encryption

Document bodies are encrypted before they reach storage. The server needs a secret key kept outside the data directory. Losing that key makes the documents unreadable.

Encryption does not hide everything. Database names, document IDs, index definitions, indexed values, and record sizes remain visible because the database needs them to find and order data.

Language versions

Implementations

Current

Go

The working prototype is a single-process HTTP service with durable storage, encryption, indexes, and JSONPath queries.

Read the Go implementation notes →

Planned

Rust

The Rust port will start after the Go design settles.