Skip to content

Getting Started ​

Arkorm is a framework-agnostic ORM designed to run anywhere Node.js runs. It brings a familiar model layer and fluent query builder on top of adapter-backed execution, with Prisma compatibility preserved during the current migration window.

If you are upgrading an existing 1.x app, start with Upgrade Guide before following the new default setup path below.

1. Install dependencies ​

Use the default package name for stable releases. If you want the current 2.x preview line, install arkormx@next instead.

bash
pnpm add arkormx@next kysely pg
bash
npm install arkormx@next kysely pg
bash
yarn add arkormx@next kysely pg

2. Configure Arkorm ​

Initialize Arkorm centrally in arkormx.config.ts:

ts
import { createKyselyAdapter, defineConfig } from 'arkormx'
import { Kysely, PostgresDialect } from 'kysely'
import { Pool } from 'pg'

export default defineConfig({
  adapter: createKyselyAdapter(
    new Kysely<Record<string, never>>({
      dialect: new PostgresDialect({
        pool: new Pool({
          connectionString: process.env.DATABASE_URL,
        }),
      }),
    }),
  ),
})

If you still need Prisma for compatibility mode, CLI flows, or Prisma-backed Model.transaction(...), add it later as an opt-in companion config. The full examples are in Setup and Prisma Compatibility.

Or run the Arkorm CLI command npx arkormx init to initialize your project along with the configuration.

3. Define a model ​

ts
import { Model } from 'arkormx'

export class User extends Model {}

For conventional models, Arkorm can infer the runtime table/delegate name from the model class. Add delegate or table only when your storage name differs from that convention. The inferred fallback uses plural snake case by default and can be customized with defineConfig({ naming: { case: ... } }).

4. Run queries ​

ts
const users = await User.query().whereKey('isActive', true).latest().limit(10).get()

5. Optional Prisma compatibility ​

Install Prisma only if you want the compatibility adapter, Prisma-backed transactions, or CLI flows that depend on the Prisma client:

bash
pnpm add @prisma/client
pnpm add -D prisma

Next steps ​