prorm

    A TypeScript ORM for 27 SQL dialects, 4 graph dialects and ~102 data stores, with the SQL it generates documented on every page. And the control-plane API that provisions and runs them.

    Get started Browse dialects API reference

    Quick start

    From an empty directory to a working model with real queries, in ten minutes.

    Get started

    Dialects & stores

    What each engine supports, where it diverges, and the SQL prorm emits for it.

    Browse dialects

    Control-plane API

    Accounts, provisioning, the long-running actions that follow, and the billing and teams around them: 308 operations.

    Open the API

    Control-plane API reference

    Every operation at api.prod-orm.io, generated from openapi.yml and grouped the way the console is: 308 operations in nine groups.

    Getting started2Liveness, and this description. Account21Sign-up and verification, the profile, and family. Security87Sessions, MFA, single sign-on, klock, devices, access rules, recovery, Kerberos, MCP tokens. Logging and monitoring10The audit log, metrics and events, and long-running operations. Databases94Provisioning, connections, schema, migrations, backups, policies, pools, transfers. Teams21Teams, their members and roles, and projects. Billing23Plans and pricing, subscriptions and invoices, team billing. Support10Support chat. Administration40Staff only: users, permissions, teams, assumed identities, the inbox.
    Introduction Authentication Errors Download openapi.yml
    Internal (repo)5How the control plane is deployed: the data plane, where customer databases live, and the Kerberos authority. Password required.

    Get started in five minutes

    Install the package, point it at a database and define a model. SQLite needs no server at all, so the snippet on the right runs as-is.

    Get started Querying
    npm install ts-prorm-orm better-sqlite3
    import { Prorm, DataTypes } from 'ts-prorm-orm';
    
    const db = new Prorm({
      dialect: 'sqlite',
      storage: ':memory:',
    });
    await db.connect();
    
    const User = db.define('User', {
      id:   { type: DataTypes.INTEGER(),
              primaryKey: true,
              autoIncrement: true },
      name: { type: DataTypes.STRING(100) },
    });
    
    await db.sync();
    await User.create({ name: 'Ada' });
    # Is it up
    curl https://api.prod-orm.io/health
    
    # Anything that creates something takes Idempotency-Key
    curl -X POST https://api.prod-orm.io/provision/databases \
      -H "Authorization: Bearer $TOKEN" \
      -H "Idempotency-Key: $(uuidgen)" \
      -H "Content-Type: application/json" \
      -d '{ "name": "notes", "type": "postgres", "size": 1 }'
    a refusal
    { "error": "capability_missing",
      "message": "…" }

    Nothing takes SQL

    The API behind prod-orm.io describes a query as select, insert, update or delete, and a schema change as a list of operations. The ORM compiles those for whichever engine they are going to, so no statement a client sends can reach an engine.

    Send Idempotency-Key with anything that creates something and a retry replays the first response instead of creating a second thing.

    Introduction Authentication Errors
    <script src="https://prod-orm.io/cdn/prorm.min.js"></script>
    const db = await prorm.openBrowserDatabase({ database: 'notes' });
    
    const Note = db.define('Note', {
      title:    prorm.DataTypes.STRING,
      archived: prorm.DataTypes.BOOLEAN,
    });
    await db.sync();
    
    await Note.create({ title: 'Hello', archived: false });
    await Note.findAll({ where: { archived: false } });

    The same ORM, in the page

    One script tag, no build step: the same models and queries against a real SQLite database in the page, SQLite compiled to WebAssembly where Web SQL is gone. Finders, operators and views all behave as they do on a server.

    Browser guide
    await User.findAll({
      where: { age: { [Op.gte]: 18 } },
      order: [['name', 'ASC']],
      limit: 10,
    });
    generates
    SELECT "id", "name", "age" FROM "users"
    WHERE "age" >= 18
    ORDER BY "name" ASC
    LIMIT 10;

    Every page shows the SQL

    The guides pair each API with the statement it produces, per dialect, so you can check what actually reaches your database rather than inferring it. Where engines differ, the difference is spelled out.

    All pages Querying

    The learning path

    These ten pages are meant to be read in order; each one assumes only what came before it. After them you can use the ORM for real work. Everything else is reference to reach for when a need comes up.

    1. 1Modelseverything a model definition can express
    2. 2Data typeswhich type to reach for, and how each maps per engine
    3. 3Queryingthe finders, and how one FindOptions becomes SQL
    4. 4Query operatorscomparisons, ranges, pattern matching, JSON access
    5. 5Associationsthe four shapes, and which side owns the foreign key
    6. 6Eager loadingrelated rows without the N+1 problem
    7. 7Validationrejecting bad data before it reaches the database
    8. 8Hooksrunning logic around the lifecycle
    9. 9Transactionsseveral writes that succeed or fail together
    10. 10Migrationsevolving a schema you cannot simply drop
    Start at the beginning

    Everything in here

    The first few sections are a path; the rest are reference you come back to.

    Getting startedInstall to first query in ten minutes, every snippet runnable. Guides71Models, querying, associations, validation, hooks, transactions, migrations. Going furtherPerformance, schema tooling, the type system, and operational concerns. Compliance15What you may hold, from what age, where: declared on the model, checked, enforced, and printed as a sheet. Diagrams17SVG generators, each shown with the output it actually produces. Running databases9Every engine in Docker, with prorm pointed at it. SQL dialects79Per-engine behaviour, and the SQL prorm emits for each one. Operational runbooks7What to do when the database layer misbehaves in production. Control-plane API308Accounts, security, databases, teams, billing and administration at api.prod-orm.io.

    Open source

    Clone it, run the suite against a containerised engine, send a patch.

    GitLab

    The source, the issue tracker and the pipeline that builds these pages.

    Repository

    npm

    Published as ts-prorm-orm. Types are bundled; no @types package needed.

    View on npm