Skip to main content
KavachOS uses Drizzle ORM under the hood. You pick a provider and pass the connection URL; KavachOS handles the rest.

Choosing a provider

Setup

SQLite is the default for development. No peer dependencies beyond better-sqlite3, which ships with kavachos.
For in-memory SQLite (tests and CI), use :memory: as the URL:
KavachOS enables WAL mode and foreign keys automatically:

Auto-migration

By default, KavachOS calls CREATE TABLE IF NOT EXISTS for all its tables on startup. This means your database is always ready to use without any manual migration step. To disable this (e.g. when you manage migrations externally with Flyway, Liquibase, or drizzle-kit push), set skipMigrations: true:
When skipMigrations: true, you are responsible for keeping the schema in sync. KavachOS will fail at runtime if expected tables or columns are missing.

Schema overview

KavachOS creates the following tables in your database: All table and column names use snake_case. All IDs are text (UUID or CUID2). Timestamps are stored as Unix seconds integers.

Peer dependencies

KavachOS uses dynamic imports for Postgres and MySQL drivers so they remain optional. You will get a clear error message at startup if the required package is missing:

Testing with in-memory SQLite

Use :memory: for fast, isolated tests that need no setup or teardown:
Each createKavach() call with :memory: gets a completely isolated database, so tests never share state.
Last modified on April 29, 2026