Vasta Logo
Getting Started

Introduction

Learn about Vasta

Vasta is a type-safe Node Object Relational Mapper (ORM) layer for Kysely with syntax and usage inspired by Laravel's Eloquent ORM. With Vasta, you can define your models and relationships in a clean and intuitive way, while still leveraging the power and flexibility of Kysely for your database interactions.

Vasta provides an active record pattern interface for querying and manipulating your data, making it easy to work with your database in a model-instance oriented way. You can define your models with attributes, relationships, methods, and more. You can use these model properties to perform actions directly on your models before easily saving those changes to the database.

const pet = await Pet.findOrFail(1);
pet.name = "Fluffy";
await pet.save();

Type Safety

Vasta is built with TypeScript and provides type safety for your models and queries. This means that you can catch errors at compile time and have better autocompletion in your code editor. When you define your models, Vasta will infer the types of your attributes and relationships, allowing you to work with your data in a type-safe way.

The strings use throughout the queries are all type-safe, only allow specific values, and also provide strong intellisense and autocompletion. This strategy helps prevent the need for constant imports and provides an excellent developer experience.

For example:

await Pet.where("name", "Zuko").firstOrFail();

In this example, the where method is type-safe and will only allow valid column names and query values based on the specific column. Similarly, the value must be of the correct type for the column, so if name is a string column, you cannot pass a number as the value.

Copyright © 2026