A SQLite-compatible embedded database engine written from scratch in Rust.
Status: Early development. Not ready for production use.
- Full SQL support (CREATE TABLE, INSERT, SELECT, UPDATE, DELETE, JOINs, subqueries, aggregations)
- ACID transactions via WAL (Write-Ahead Logging)
- B-tree indexed storage
- Small footprint, single-file database
- Drop-in compatibility with the SQLite C API (via FFI in future)
- No external dependencies beyond the Rust standard library
src/
├── sql/ Lexer → Parser → AST
├── planner/ Query optimization & plan generation
├── vdbe/ Virtual Database Engine (bytecode VM)
├── btree/ B-tree index & table storage
├── pager/ Page cache & WAL transaction manager
├── storage/ File I/O, disk layout, schema management
└── cli/ Interactive REPL shell
SQL text → Lexer → Tokens → Parser → AST → Planner → Bytecode → VDBE → B-tree → Pager → Disk
cargo build --release# Start REPL (data sparas i sakdb.db som standard)
cargo run
# Eller ange en sökväg
cargo run -- min.dbThis starts an interactive SQL shell. All data persists to disk as JSON:
sakdb> CREATE TABLE users (id INT PRIMARY KEY, name TEXT);
sakdb> INSERT INTO users VALUES (1, 'Alice');
sakdb> SELECT * FROM users;
1|Alice
sakdb> .exit
- Phase 1 – Lexer, Parser, AST for DDL + simple DML
- Phase 2 – B-tree storage engine, pager, WAL
- Phase 3 – VDBE execution engine, INSERT/SELECT with WHERE
- Phase 4 – Indexes, constraints, transactions
- Phase 5 – JOINs, subqueries, GROUP BY, aggregations
- Phase 6 – C API compatibility layer, SQLite file format support
MIT