An ultra lightweight & fast, portable & type-safe in-memory database optimized for OLTP workloads.
- PawnDB is written in ISO C++17, without any compiler extensions.
- PawnDB follows Google coding style.
This repository includes a dev container in .devcontainer/ based on Ubuntu,
with cmake, ninja, clang/gcc, doxygen, gcovr, pre-commit, gh,
and Node.js (for Claude Code and Continue extensions).
Runtime also needs API keys for Claude Code and Continue. Create .devcontainer/.env (it is gitignored):
# Create .devcontainer/.env
ANTHROPIC_AUTH_TOKEN=<your-deepseek-api-key>
CONTINUE_API_KEY=<your-deepseek-api-key>The GitHub token is needed as a BuildKit secret during image build, so export it in your shell:
export GH_TOKEN=<your-github-token>docker build \
-f .devcontainer/Dockerfile \
--tag pawndb-dev:latest \
--secret id=gh_token,env=GH_TOKEN \
.Open this repository in VS Code and run:
Dev Containers: Rebuild and Reopen in Container
Or build from CLI with BuildKit:
docker build \
-f .devcontainer/Dockerfile \
--tag=pawndb-dev:latest \
--secret id=gh_token,env=GH_TOKEN \
.If this is your first time, clone the repo into the workspace folder and build:
cd /workspaces
# Change volume owner to ubuntu, by default it is root
sudo chown -R ubuntu:ubuntu /workspaces/*
# Populate the volume with this git repo
git clone --recurse-submodules https://github.com/xiahualiu/PawnDB.git PawnDB
# Install pre-commit hook
cd PawnDB
pre-commit install
# Build for the first time
cmake -S . -B build -G Ninja -DCMAKE_TOOLCHAIN_FILE=cmake/toolchains/clang.cmake -DCMAKE_EXPORT_COMPILE_COMMANDS=ON
cmake --build build --target pawndb-appHard requirements:
-
clangversion > 16.0, orgccversion > 8.0. -
cmakeversion > 3.20. -
ninjabuild system. -
doxygenfor generating document html. (Optional) -
gcovrfor showing test coverage report. (Optional) -
clang-formatversion > 18.0. (Optional)
Use the following command to build and run the executable target.
cmake -S . -B build -G Ninja -DCMAKE_TOOLCHAIN_FILE=cmake/toolchains/clang.cmake -DCMAKE_EXPORT_COMPILE_COMMANDS=ON
cmake --build build --target pawndb-app
./build/apps/pawndb-cli/pawndb-appUse the following commands from the project's root directory to run the test suite.
cmake -S . -B build -G Ninja -DPAWNDB_ENABLE_TEST=ON -DCMAKE_TOOLCHAIN_FILE=cmake/toolchains/clang.cmake -DCMAKE_EXPORT_COMPILE_COMMANDS=ON
cmake --build build --target clean-coverage
cmake --build build --target run-all-tests
cmake --build build --target show-test-coverageYou can run a specific test target, for example:
cmake --build build --target parser-test
./build/tests-unit/parser/parser-testcmake -S . -B build -G Ninja -DPAWNDB_ENABLE_STYLE=ON -DCMAKE_TOOLCHAIN_FILE=cmake/toolchains/clang.cmake
cmake --build build --target check-clang-formatcmake -S . -B build -G Ninja -DPAWNDB_ENABLE_STYLE=ON -DCMAKE_TOOLCHAIN_FILE=cmake/toolchains/clang.cmake
cmake --build build --target apply-clang-formatThis repo includes a .pre-commit-config.yaml hook that runs the CMake
check-clang-format target before each commit.
In the dev container, pre-commit is preinstalled via apt:
Run it manually on all files:
pre-commit run --all-filescmake -S . -B build -G Ninja -DPAWNDB_ENABLE_DOXYGEN=ON -DCMAKE_TOOLCHAIN_FILE=cmake/toolchains/clang.cmake
cmake --build build --target doxygen