> ## Documentation Index
> Fetch the complete documentation index at: https://gligabao.mintlify.site/llms.txt
> Use this file to discover all available pages before exploring further.

# Database

> Choose SQLite or PostgreSQL for the main database.

The main database is SQLite (default, one file) or PostgreSQL, chosen with `db_backend` in the config:

```toml theme={null}
db_backend = "postgres"
postgres_dsn = "postgres://user:password@localhost:5432/gligabao?sslmode=disable"   # or the POSTGRES_DSN env var
```

The schema is created on startup. SQLite takes its file from `serve --db` (default `build/gligabao.db`).

All SQL lives in the backend packages, each with its own schema and dialect; the rest of the code calls routing functions that dispatch to the backend in use:

* Datasets and the LLM call log: `internal/db/relational` (`sqlite`, `postgres`).
* The knowledge graph (artifacts, entities, edges): `internal/db/graph` (currently `sqlite` and `postgres` tables in the same database; dedicated graph databases are meant to be added there).

## Tests

Tests run against SQLite, and also against PostgreSQL when `POSTGRES_TEST_DSN` is set (each test gets a temporary schema):

```sh theme={null}
POSTGRES_TEST_DSN='postgres://user:pw@localhost:5432/gb?sslmode=disable' ./run_tests.sh
```

See also [Vector storage](https://gligabao.mintlify.site/guides/vectors.md) for where embeddings live.


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.