G GhostDB / docs
live documentation Python · zero dependencies

Database you can touch.

GhostDB turns transactions into a hands-on experiment: enter commands, change memory state, and watch exactly what COMMIT or ROLLBACK does.

0 filesRAM only
∞ layersnested transactions
9 cmdssmall API
ghostdb / runtime
DB
in memory
commandSET A 10process()
transactionT2 · activesnapshot: A
statedb = { A: 10 }
01 · interactive lab

Explore the state

This browser-based mirror of `cli.py` keeps the console, memory, counters, and transaction stack in sync.

GhostDB Playground
client-side emulator
02 · small surface area

Commands without noise

One command, one idea. Read the implementation and test its behavior in the lab above.

KV

SET / GET

Put a value in RAM and retrieve it by key. A missing key returns NULL.

∑

FIND / COUNTS

Find every key with a value or count how many times that value appears.

↶

ROLLBACK

Return the active layer to its snapshot without touching the parent transaction.

↗

COMMIT

Confirm a layer or pass its original values up to the parent layer.

03 · under the hood

Snapshot on first change

When a transaction changes a key for the first time, GhostDB saves its previous value in the current layer. Then ROLLBACK restores the snapshot, while COMMIT moves the history to the outer layer.

01
BEGINAdds a new empty layer.
02
SET / UNSETSaves a key's old value once.
03
COMMIT / ROLLBACKApplies changes or rebuilds the previous state.
01transactions = []
02BEGIN → T1
03SET A 10
04BEGIN → T2
05SET A 20 # snapshot A=10
06ROLLBACK # A ← 10
07COMMIT # T1 applied
08// nothing persisted to disk