Documentation

Mask is a natural-language database layer for Node.js. You describe models (schemas) and queries in plain English; the compiler turns them into database code for MongoDB, SQL, Neo4j, and more. At runtime there are no AI calls — everything is pre-compiled. Mask Databases stores and syncs compiled data per project so teams and deployment pipelines can share it.

To get started you only need two things: define your models with MaskModels.define('...') and run queries with MaskDatabase.prompt('...'). The generated code picks the right collections from the prompt automatically.

What Mask does

  • Models — Call MaskModels.define('User collection with name, email, teamId...'). The compiler turns that into a schema (collection name, fields, relations). Queries use that schema so field names and collections are always correct.
  • Queries — Call MaskDatabase.prompt('find all users with status active') or MaskDatabase.prompt('mask-userById', { userId }). At runtime you call prompt() with the same string (and params) and get the result. No AI at runtime.
  • Compiling — Run node mask.compile.cjs (or node mask.compile.cjs --watch when your entry supports it) after you add or change models or queries.
  • Sync (Mask Databases) — Set syncApiKey in mask.compile.cjs (overrideConfig). Use mask-sync-fetch to get the latest and mask-sync-push to share your changes.

Full feature set

FeatureDescription
ModelsMaskModels.define('...') with collection, fields, and relations in natural language. Schemas can live in any file; the compiler finds all define() calls across your code.
Queries (inline)MaskDatabase.prompt('find all users') — use the exact same string everywhere you need that query.
Queries (registery)Put long prompts under registery in overrideConfig in mask.compile.cjs; in code use MaskDatabase.prompt('mask-key'). One source of truth, reuse across files. Details
ParametersIn prompt: :userId, :projectId. At runtime: MaskDatabase.prompt('...', { userId, projectId }).
Query typesFind, aggregation (joins/lookups), insert, update, delete — the compiler picks from your natural language.
MySQL/MariaDB noteWhen using mysql2, set multipleStatements: true in your SQL connection options so compiled write prompts that run multiple statements in one call work correctly.
getQueryForPromptSee the generated query for a prompt without executing it — useful for debugging and verification. Details
getModelForPromptInspect the compiled schema for a model without instantiating it — verify collection, fields, types, and relations. Details
driverOptions (MongoDB / Mongoose)Describe extra driver behavior in your prompt at compile time (upsert, collation, returning full documents, etc.). Details
Legacy pass-through modeFor existing apps, you can provide exact schema/query code in prompts so compiled behavior stays aligned. See Models and Queries.
Compilenode mask.compile.cjs or node mask.compile.cjs --watch. Turns your models and queries into runnable code.
SyncsyncApiKey in mask.compile.cjs; mask-sync-fetch / mask-sync-push; dashboard to manage data.
Delete promptsmask-delete — remove prompts from local files by hash, prompt text, or all failed prompts with --failed. Interactive shell or one-shot CLI. Details
DB moduleYour app exports a connection function (e.g. getDB() for MongoDB) from a path set in dbModulePath.

Getting started

Create an account, create a project, get your API key, and configure Mask.

Models

Define schemas in natural language with MaskModels.define(): collections, fields, and relations.

Queries

Write queries in plain language, use the prompt registery in mask.compile.cjs, pass parameters, and debug with getQueryForPrompt.

Compiling

When and how to run node mask.compile.cjs, watch mode, and how it fits with sync.

Configuration

mask.compile.cjs at project root: overrideConfig with database, DB module, API key, and optional scan paths. MySQL / MariaDB: set multipleStatements: true in your connection config.

Supported databases

MongoDB, Mongoose, MySQL, PostgreSQL, SQLite, Neo4j, Oracle — quick comparison and DB-specific setup.

Sync (fetch / push)

Use mask-sync-fetch to get the latest and mask-sync-push to share your changes across your team.

Dashboard

Sign in to create projects, copy API keys for syncApiKey, and manage your data.