What is NarDB?
A schema-based database in one .ndbc container, designed together with LexerLang.
NarDB is a database engine written in Go for the LexerLang ecosystem. A database is a .ndbc container (nar database container): a folder holding the catalog, the indexes and one file per partition. Schemas, users, pool settings and the distribution map all live inside it. No server is needed.
The name comes from nar, Turkish for pomegranate. A pomegranate holds many seeds in one shell; NarDB aims to present parts that live in different files or on different servers as one database.
Three parts#
| Part | What it does |
|---|---|
Engine (nardb) | Page-based B+tree, catalog, schema language, queries. Embedded as a Go package. |
NarDB Shell (nardb_shell) | A QBASIC-style, keyboard-driven UI: menus, query editor, result table, >> command line. |
| Query language (NarQL) | Not SQL. A chained language: from('members').where({...}).get(); |
At a glance#
create_schema('products')
.fields({
'code': {type: string, max_length: 20, encoding: ascii, primary_key: true},
'name': {type: string, max_length: 80},
'price': {type: decimal, precision: 10, scale: 2, check: {min: 0}}
})
.commit();
from('products').insert_one({code: 'NAR-001', name: 'Pomegranate 🍉', price: 89.90});
from('products').where({'price': {lt: 100}}).fields('name', 'price').get();What works today#
NarDB is in development (version 0.2.0-dev). These docs only describe features that work; planned features are marked as such.
Works: the container format, a write-ahead log (WAL) with crash recovery, all-or-nothing statements, a page cache, one file per partition, encryption at rest (XChaCha20-Poly1305), B+tree tables and indexes, creating, altering and dropping schemas, insert, update and delete, where, order, limit, CAST / FORMAT / TO_DATE, users (Argon2id) and schema grants, pool limits, encrypted .ndbz backups, a gRPC server with mutual TLS (nardbd) and a Go client, defining the distribution map, NarDB Shell.
Not yet:
- Multi-statement transactions: each statement is atomic on its own;
begin/commitaround several statements does not exist yet. join: the syntax is recognized but the engine does not run it.- Distributed reads and writes:
file()andremote()partitions are not accessed yet. - LexerLang connection: the LexerLang connector is not written yet, and NarDB Shell cannot connect to a remote server yet.
- Export: results cannot be exported to csv, json or xlsx yet.