Two Modes, One Database

Loka can run as an embedded database (open a .sdb file directly, like SQLite) or as a server (HTTP SPARQL endpoint). Both use the same storage format, the same query engine, and the same indexes. The difference is how you access the data.

Embedded (Serverless) — Recommended

  • Open a .sdb file directly — no daemon, no config
  • Zero setup: download the binary, point at a file, query
  • Data is a file you can see, copy, and move
  • Single-process access only
  • No network overhead

Server Mode — When You Need It

  • HTTP SPARQL endpoint at localhost:3030/sparql
  • Multiple clients can query concurrently
  • Remote access from other machines
  • Optional auth, rate limiting, query timeouts
  • Periodic backups, health monitoring
# Embedded: query a file directly
loka query "SELECT ?s WHERE { ?s a :Person }" --data people.sdb

# Server: start an HTTP endpoint on the same file
loka serve --port 3030 --data people.sdb
# Now accessible at http://localhost:3030/sparql

When to Use Each Mode

Use CaseRecommended ModeWhy
Personal project, scripts, prototypingEmbeddedZero setup, fastest possible path to querying
AI agents (Claude Code, Cursor, etc.)EmbeddedNo process management, no port conflicts, deterministic
Jupyter notebook explorationEitherEmbedded for local; server if sharing with collaborators
Web application backendServerMultiple clients need concurrent access via HTTP
Multiple processes reading the same dataServerEmbedded mode is single-process; server handles concurrency
Remote access from other machinesServerEmbedded mode has no network interface
Production deploymentServerAuth, rate limiting, monitoring, backups

Benefits of Embedded Mode

Embedded mode follows the SQLite philosophy: download one binary, run one command, you have a working database. This is the default because it removes every obstacle between you and your data.

Benefits of Server Mode

Server mode adds capabilities that embedded mode cannot provide. For anything beyond single-user local access, server mode is the right choice.

Tradeoffs

EmbeddedServer
Setup complexityNoneMinimal (one command, but you manage a process)
Concurrent accessSingle process onlyMultiple clients
Network accessLocal onlyRemote + local
Auth & securityFile system permissionsPasscode auth, rate limiting, query timeouts
BackupsCopy the file yourselfAutomatic periodic backups
Data visibilityPlain file — easy to find, but also easy to accidentally deleteManaged by the server process
Performance overheadNone (direct access)HTTP serialization/deserialization per query
Same file, either mode The .sdb file format is the same regardless of how you access it. You can prototype in embedded mode, then deploy the same file in server mode without any migration or conversion.

Comparison with Other Databases

DatabaseEmbeddedServerData Model
Loka Yes (default) Yes RDF-star + vectors
SQLite Yes No Relational
PostgreSQL No Yes Relational
Apache Jena Fuseki No Yes RDF
Neo4j Yes (embedded Java) Yes Property graph
Qdrant No Yes Vectors