Introduction
Vasta is a type-safe 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();
Usage
To get started with Vasta, you can define your model class by extending the defineModel function and specifying the table name and attributes. You can then use the provided query builder methods to perform various database operations.