Vasta is a type-safe Active Record ORM for TypeScript, built on top of Kysely (v0.29+). It provides a Laravel Eloquent-inspired interface for defining models with relationships, attributes, and lifecycle hooks, while leveraging Kysely's SQL query builder for raw performance. Version 0.0.14 is the latest stable, with an active development cadence (weekly releases). Key differentiators: full TypeScript type safety via Kysely's types, active record pattern with instance-based saves, and support for eloquent-style relationships (hasOne, hasMany, belongsTo) without sacrificing the ability to drop down to raw SQL via Kysely.
npm install vasta-ormNo compatibility data collected yet for this library.
Verified import paths — ran on the pinned version, not inferred.
Shows defining a Pet model extending Model, setting up Kysely with PostgreSQL, querying a record, modifying it, saving, and accessing a relationship.
Install kysely@^0.29.0 via npm install kysely@^0.29.0
Use explicit relationship methods like this.hasMany(RelatedModel, foreignKey) instead of this.relation('hasMany', ...).Update Model instantiation: new Model(db, attributes) or use Model.findOrFail(db, id).
Define an interface for your table and pass it as the second generic parameter.
For now, set static timestamps = true. Monitor changelog for changes.
For atomic operations, wrap multiple saves in a Kysely transaction and pass the transaction object to Vasta methods if supported (check docs).
Use named import: import { Model } from 'vasta-orm'Call Model.setDb(kyselyInstance) before any model operations, or pass db to constructor.
Run npm install vasta-orm and ensure tsconfig.json has 'moduleResolution': 'node' or 'bundler'.