Skip to main content

Documentation Index

Fetch the complete documentation index at: https://zapo.to/llms.txt

Use this file to discover all available pages before exploring further.

Each backend package exports a create*Store factory you pass into a backends entry of createStore. All backends implement the same per-domain store contracts, so switching backends is a config change, not a code change.

SQLite

@zapo-js/store-sqlitecreateSqliteStore(config).
import { createSqliteStore } from '@zapo-js/store-sqlite'

const sqlite = createSqliteStore({
  path: '.auth/state.sqlite',
  driver: 'auto'
})
FieldTypeDescription
pathstringDatabase file path. Required.
driverWaSqliteDriverNative driver selection ('auto', …).
pragmasRecord<string, string | number>SQLite pragmas.
tableNamesWaSqliteTableNameOverridesOverride table names.
batchSizesWaSqliteBatchSizeSelectionTune batch sizes.
cacheTtlMs{ retryMs?, groupMetadataMs?, deviceListMs?, messageSecretMs? }Cache TTLs.
Requires the better-sqlite3 peer dependency.

PostgreSQL

@zapo-js/store-postgrescreatePostgresStore(config).
import { createPostgresStore } from '@zapo-js/store-postgres'

const postgres = createPostgresStore({
  pool: { connectionString: process.env.DATABASE_URL },
  tablePrefix: 'wa_'
})
FieldTypeDescription
poolPool | PoolConfigAn existing pg pool or a pool config. Required.
tablePrefixstringPrefix for created tables.
cacheTtlMsobjectCache TTLs (same shape as SQLite).
cleanup{ intervalMs?, onError? }Background cleanup poller.
Also exports createPgPool and ensurePgMigrations. Requires the pg peer dependency.

MySQL

@zapo-js/store-mysqlcreateMysqlStore(config).
import { createMysqlStore } from '@zapo-js/store-mysql'

const mysql = createMysqlStore({
  pool: { uri: process.env.MYSQL_URL },
  tablePrefix: 'wa_'
})
FieldTypeDescription
poolPool | PoolOptionsA mysql2 pool or options. Required.
tablePrefixstringPrefix for created tables.
cacheTtlMsobjectCache TTLs.
cleanup{ enabled?, intervalMs?, onError? }Background cleanup poller.
Also exports createMysqlPool and ensureMysqlMigrations. Requires the mysql2 peer dependency.

Redis

@zapo-js/store-rediscreateRedisStore(config).
import { createRedisStore } from '@zapo-js/store-redis'

const redis = createRedisStore({
  redis: { host: '127.0.0.1', port: 6379 },
  keyPrefix: 'wa:'
})
FieldTypeDescription
redisRedis | RedisOptionsAn ioredis instance or options. Required.
keyPrefixstringPrefix for all keys.
cacheTtlMsobjectCache TTLs.
Requires the ioredis peer dependency.

MongoDB

@zapo-js/store-mongocreateMongoStore(config).
import { createMongoStore } from '@zapo-js/store-mongo'

const mongo = createMongoStore({
  db: { uri: process.env.MONGO_URL, database: 'zapo' },
  collectionPrefix: 'wa_'
})
FieldTypeDescription
dbDb | { uri, database, options? }A mongodb Db or connection info. Required.
collectionPrefixstringPrefix for created collections.
cacheTtlMsobjectCache TTLs.
Requires the mongodb peer dependency.

Mixing backends

createStore lets each domain choose a backend by name, so you can combine them:
createStore({
  backends: { redis, postgres },
  providers: {
    auth: 'redis', signal: 'redis', senderKey: 'redis',
    appState: 'redis', privacyToken: 'redis',
    messages: 'postgres', threads: 'postgres', contacts: 'postgres'
  }
})
See Stores for the full list of domains.
Last modified on May 27, 2026