Supported databases

Mask supports several database backends. The workflow is the same for all: configure mask.compile.cjs (overrideConfig), define models, write queries, run node mask.compile.cjs, and sync. The main difference is how you connect (the DB module export) and whether migrations are needed (SQL databases).

Common across all databases

  • Project root mask.compile.cjs calling runWithMaskConfig with overrideConfig including database, dbModulePath, and syncApiKey.
  • Define models with MaskModels.define('…') — works for SQL tables, MongoDB collections, or Neo4j graph descriptions.
  • Write queries with MaskDatabase.prompt('…'), optionally using registery inside overrideConfig for mask- keys.
  • Run node mask.compile.cjs to turn your definitions and prompts into runnable code.

Example overrideConfig (MongoDB)

{
  "database": "mongodb",
  "dbModulePath": "src/db",
  "syncApiKey": "YOUR_PROJECT_API_KEY",
  "modelPaths": ["src/tables.js"],
  "queryPaths": ["src"]
}

MongoDB summary

  • database: "mongodb"
  • DB export: getDB()
  • No SQL migrations

Summary table

Databaseconfig databaseDB exportMigrations
MongoDBmongodbgetDB()Not needed
MongoosemongoosegetMongooseConnection()Not needed
MySQLmysqlgetSqlConnection()npx mask-migrate
MariaDBmariadbgetSqlConnection()npx mask-migrate
PostgreSQLpostgresgetSqlConnection()npx mask-migrate
SQLitesqlitegetSqlConnection()npx mask-migrate
Neo4jneo4jgetNeo4jSession()Not needed
OracleoraclegetSqlConnection()npx mask-migrate