Skip to content
BeingDBPublic

About

BeingDB — facts with history

Resources

Stars

3 stars

Watchers

0 watching

Forks

Repository files navigation

BeingDB

Facts versioned like code, queried like a database.

BeingDB is a lightweight database for structured facts maintained in Git.

Facts are written as simple predicates:

created(tina_keane, shadow_of_a_journey).
shown_in(shadow_of_a_journey, rewind_exhibition_1995).
held_at(rewind_exhibition_1995, ica_london).
year_created(shadow_of_a_journey, @1979).

BeingDB compiles those facts into an optimized, read-only store that can be queried through an HTTP API, an interactive REPL, or directly in a web browser.

Why BeingDB?

The BeingDB query runtime compiles to WebAssembly, so a compiled fact store can be published as a static website and queried entirely client-side: no server, no account, and queries never leave the page. The same parser, validator, planner and evaluator used by the native server run unchanged in the browser. Try it now on the REWIND artists' interviews, learn the query language in the interactive tutorial, or see Run in the browser to publish your own facts.

RAG systems are good at retrieving relevant text, but some questions are better answered from explicit structured facts.

BeingDB provides a factual layer that can sit alongside document retrieval:

  • Git-versioned knowledge — facts are plain text and can be reviewed, changed and versioned like source code.
  • Fast read-only runtime — compile a Git repository into an optimized store for serving.
  • Server or browser — serve facts over HTTP, or run the same query engine client-side via WebAssembly.
  • Simple query language — pattern matching, joins, variables and typed comparisons.
  • LLM-friendly — language models can discover available predicates and construct queries against structured facts.
  • Reliable factual retrieval — BeingDB returns explicit facts rather than asking a language model to infer them from retrieved text.
  • No inference engine required — BeingDB handles factual retrieval and joins; reasoning can remain with the consuming application or LLM.

No schema-heavy knowledge graph or complex rule system is required. Your application or LLM handles reasoning; BeingDB provides reliable, joinable facts.

Query facts

Queries use the same predicate syntax as the underlying facts, in a find/where form: find names the variables to return, and each line after where is a pattern or comparison.

A simple query:

find Artist, Work
where
  created(Artist, Work)

returns artists and the works they created.

Queries can also join multiple relationships:

find Artist, Work, Y
where
  created_by(Work, Artist)
  year_created(Work, Y)
  Y >= 1970

This can answer questions such as:

Which artists made works in 1970 or later, and when?

Queries can search text, too. This finds exhibitions with "video" in their title:

find Exhibition, Title
where
  exhibition_title(Exhibition, Title)
  Title contains "video"

And they can count. This lists the artists with the most works:

find Artist, count(Work)
where
  created_by(Work, Artist)
order by count(Work) descending
limit 5

BeingDB performs the factual lookup and joins while the consuming application decides how to interpret or present the results.

Designed for LLMs

BeingDB is intended to work particularly well as a structured factual component in an LLM or RAG stack.

Instead of relying on semantic retrieval for every question, an LLM can query explicit relationships when the answer depends on known facts.

For example, a system might use:

  • document search for descriptive or contextual information;
  • BeingDB for entities, relationships, dates and other structured facts;
  • the LLM for reasoning and natural-language responses.

The API exposes the available predicates so an LLM can discover the vocabulary before constructing queries. It can also resolve the names in a question to the exact values stored (GET /resolve, tolerating misspellings and using any label/alias facts), and list everything known about one value (GET /about), so a query uses real constants rather than guessed ones.

For MCP-based integrations, see the BeingDB MCP server.

Quick start

Install BeingDB (see Installation), then clone some example facts:

beingdb clone \
  https://github.com/jptmoore/beingdb-sample-facts.git \
  --git ./git_store

Compile the Git repository into a pack store:

beingdb compile \
  --git ./git_store \
  --pack ./pack_store

Start the HTTP server:

beingdb serve \
  --pack ./pack_store

BeingDB is now ready to query.

HTTP API

Query the database:

curl -X POST http://localhost:8080/query \
  -H "Content-Type: application/json" \
  -d '{"query":"find Artist, Work\nwhere\n  created(Artist, Work)"}'

A multi-predicate query can perform joins:

curl -X POST http://localhost:8080/query \
  -H "Content-Type: application/json" \
  -d '{"query":"find Artist, Work, Exhibition\nwhere\n  created(Artist, Work)\n  shown_in(Work, Exhibition)"}'

The API can also expose the predicates available in the compiled database, allowing applications and LLMs to discover the vocabulary they can query.

Find the stored values a question mentions, and everything about one of them:

curl -G http://localhost:8080/resolve --data-urlencode 'text=What did Tina Keane create?'
curl 'http://localhost:8080/about?value=tina_keane'

See the API documentation for details.

REPL

BeingDB also includes an interactive REPL:

beingdb repl --pack ./pack_store

Type a query and finish it with a blank line:

beingdb> find Artist, Work, Exhibition
...> where
...>   created(Artist, Work)
...>   shown_in(Work, Exhibition)
...>

The REPL uses the predicates in the database to provide a query environment tailored to the available facts.

Run in the browser

A compiled store can also be published as a static website, queried in the browser by the same engine compiled to WebAssembly (beingdb-wasm). Visitors install nothing, and any static host will do, such as GitHub Pages.

Export the compiled store as a single file:

beingdb export --pack ./pack_store -o facts.browser.json

Then bundle it into a site with beingdb-wasm (needs only Node):

git clone https://github.com/beingdb/beingdb-wasm.git
cd beingdb-wasm
npm run bundle -- --data ../facts.browser.json --title "My facts" --out ../my-site

and publish the my-site/ folder. See beingdb-wasm for configuring the page and the JavaScript API.

If your facts are in a GitHub repository, bundle into its docs/ folder and let GitHub Pages serve it. The REWIND interviews repository does exactly that, with the live site.

Example

A sample repository is available at:

github.com/jptmoore/beingdb-sample-facts

It provides a small dataset that can be cloned, compiled and queried with BeingDB.

For a larger dataset running entirely in the browser, see the REWIND interviews site and the BeingDB tutorial built on it.

Documentation

More detailed documentation is available in the docs directory:

License

MIT

About

BeingDB — facts with history

Resources

Stars

3 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages