kastor0.1.0
Get started

CHANGE ORDERMigrate to kastor

Migrate to kastor from Prisma and other ORMs

Your database and your data stay where they are. You swap the layer on top: a TypeScript schema instead of a model file, a typed client instead of the old one, and kastor migrations that start from what is already deployed.

Em português: Como migrar do Prisma para o kastor and Vindo do Laravel e do Eloquent

Three commands do the heavy lifting

  1. 1

    Get a TypeScript schema

    From Prisma, convert the model file directly with the first command. From any other ORM or language, use the second: it reads the live database, with tables, columns, indexes, foreign keys and the relations between them.

    Terminal
    npx kastor import prisma --schema prisma/schema.prisma --out src/db/schema.ts
    npx kastor db pull --out src/db/schema.ts
  2. 2

    Adopt the database as it is

    A baseline records the current schema as the first kastor migration and marks it applied, so nothing is created twice and no data moves. Prisma projects use the second form, which also keeps every migration Prisma already applied as history.

    Terminal
    npx kastor migrate baseline --name init
    npx kastor migrate baseline --from-prisma prisma/migrations
  3. 3

    Move queries, then let kastor own migrations

    Rewrite one module at a time while both clients share the database. When the old ORM has no importers left, new schema changes go through kastor, and CI runs migrate deploy.

    Terminal
    npx kastor migrate status
    npx kastor migrate dev --name add_slug_to_posts
    npx kastor migrate deploy

From another TypeScript or JavaScript ORM

From PHP, Python or Ruby

kastor runs in JavaScript runtimes: Node.js, Bun, Deno, Cloudflare Workers and other edge platforms. It does not run inside PHP, Python or Ruby. These guides cover the two honest paths: moving a service to TypeScript, or running a TypeScript API next to the existing app on the same database.

Where each guide starts

Coming fromFirst commandMigration history
Prismanpx kastor import prismaKept: migrate baseline --from-prisma
Drizzle ORMnpx kastor db pullBaseline, then kastor owns new migrations
TypeORMnpx kastor db pullBaseline, then kastor owns new migrations
Sequelizenpx kastor db pullBaseline, then kastor owns new migrations
Knexnpx kastor db pullBaseline, then kastor owns new migrations
Mongoosenpx kastor db pullValidators and indexes from the schema
Laravel Eloquent (PHP)npx kastor db pullBaseline, PHP and TypeScript share the database
Django ORM (Python)npx kastor db pullBaseline, Django keeps or hands over migrations
Rails Active Record (Ruby)npx kastor db pullBaseline, Rails keeps or hands over migrations

Then wire it into your framework

Every framework guide shows the project structure, one client reused across hot reloads and serverless invocations, the environment variables and how migrations run in CI. Start from the framework overview or the list of framework guides.

Suggestions

Kas looked under every log. Nothing matches that yet.

Try a method name, a database or a framework.