Ctrl Plane

SQLite Store

Lightweight SQLite backend using Grove ORM with sqlitedriver.

The SQLite store (store/sqlite) provides a lightweight, embedded backend using the Grove ORM with sqlitedriver. It implements the full store.Store interface and is well-suited for single-node deployments, local development, and testing.

When to use

  • Local development -- single-file database, no server process required.
  • Testing -- fast, isolated store with no external dependencies.
  • Edge / embedded -- CLI tools, desktop apps, or single-process services.
  • CI pipelines -- deterministic tests without a database container.

Configuration

import (
    "github.com/xraph/grove"
    "github.com/xraph/grove/drivers/sqlitedriver"
    "github.com/xraph/ctrlplane/store/sqlite"
)

// Open a SQLite connection via Grove's sqlitedriver.
db := grove.Open(sqlitedriver.New("ctrlplane.db"))

s := sqlite.New(db)
if err := s.Migrate(ctx); err != nil {
    log.Fatal(err)
}

With the app

cp, err := app.New(
    app.WithStore(s),
)

Internals

AspectDetail
DriverGrove ORM with sqlitedriver (SQLite)
MigrationsGrove migration orchestrator with programmatic migrations
TransactionsDatabase-level transactions via SQLite
MigrateCreates tables and indexes
Pingdb.Ping(ctx)
CloseCloses the database connection

Limitations

  • Single-writer -- SQLite uses database-level write locks. High write concurrency will serialize.
  • Single process -- cannot be shared across multiple instances.
  • Not horizontally scalable -- suited for single-process or embedded use.

Comparison

FeatureMemoryBadgerPostgreSQLSQLiteMongoDB
SetupNonePath onlyDSNFile pathURI
PersistenceNoYesYesYesYes
Multi-processNoNoYesNoYes
Query flexibilityLowLowHighMediumHigh
Best forTestsEmbedded KVProduction SQLEmbedded SQLProduction NoSQL

On this page