ormDB

ormDB + Kysely

Language: typescriptPackage: @ormdb/kysely-adapterStatus: planned

What This Adapter Will Do

ormDB is a relational database engine written in Rust that replaces PostgreSQL, MySQL, and SQLite as the actual database underneath your application. The planned @ormdb/kysely-adapter package will connect Kysely’s type-safe query builder to ormDB, letting you keep your existing query patterns while the database handles relation resolution natively.

Kysely builds SQL queries through a TypeScript-native builder API. With a SQL database, complex queries involving multiple joins result in large SQL statements that the database must parse and optimize. The ormDB adapter will translate Kysely’s builder output into ormDB’s native entity/relation protocol, enabling graph fetches that resolve related data in a single round-trip, eliminating N+1 queries.

Planned Setup

The adapter will follow the standard Kysely dialect pattern:

npm install @ormdb/kysely-adapter
import { Kysely } from 'kysely'
import { OrmDBDialect } from '@ormdb/kysely-adapter'
import type { Database } from './types'

const db = new Kysely<Database>({
  dialect: new OrmDBDialect({
    url: process.env.ORMDB_URL,
  }),
})

Standard queries will work through the type-safe builder:

const users = await db
  .selectFrom('users')
  .innerJoin('posts', 'posts.author_id', 'users.id')
  .innerJoin('comments', 'comments.post_id', 'posts.id')
  .select(['users.name', 'posts.title', 'comments.body'])
  .execute()

What Will Change, What Will Stay

Stays the same: Kysely’s type-safe query builder, selectFrom, insertInto, updateTable, deleteFrom, where clauses, orderBy, limit, and type inference from your database interface.

Changes: The database engine. Join patterns that represent entity relations become single-round-trip graph fetches. Migrations gain A-D safety grading. Vector search, geo search, full-text search, and change streams become available natively. Kysely with ormDB is a great choice for TypeScript projects.

Removed: Raw SQL via the sql template tag and db.executeQuery() with raw strings. All queries must use Kysely’s builder API.

Get Notified

The Kysely adapter is planned. In the meantime, try the Prisma or Drizzle adapters. To track development progress or register interest, visit the ormDB GitHub repository and join the community discussion.

Frequently Asked Questions

When will the Kysely adapter be available?

The Kysely adapter is on the ormDB roadmap. Development priority is driven by community demand. Join the ormDB GitHub discussions to signal interest and track progress.

Will Kysely's type-safe query builder work with ormDB?

The planned adapter will support Kysely's core query builder for select, insert, update, and delete operations. The adapter translates Kysely's builder output into ormDB's native protocol.

How will graph fetches work with Kysely's join-based approach?

Kysely uses explicit joins for related data. The adapter will detect join patterns that represent entity relations and convert them into ormDB graph-fetch requests, resolving them in a single round-trip.

Will Kysely's raw SQL support work?

Raw SQL via sql`` template literals will not be supported because ormDB does not use SQL. All queries must use Kysely's type-safe builder methods.

Can I use another adapter while waiting for Kysely support?

Yes. The Prisma, Drizzle, and TypeORM adapters are available in beta today. You can build with one of those and migrate to the Kysely adapter when it ships.

Related Content

Try ormDB today

Open source, MIT licensed. Install and start building.