[{"data":1,"prerenderedAt":306},["ShallowReactive",2],{"navigation_docs":3,"-getting-started-introduction":69,"-getting-started-introduction-surround":303},[4,20,60],{"title":5,"path":6,"stem":7,"children":8,"page":19},"Getting Started","/getting-started","1.getting-started",[9,14],{"title":10,"path":11,"stem":12,"icon":13},"Introduction","/getting-started/introduction","1.getting-started/1.introduction","i-lucide-house",{"title":15,"path":16,"stem":17,"icon":18},"Installation","/getting-started/installation","1.getting-started/2.installation","i-lucide-download",false,{"title":21,"path":22,"stem":23,"children":24,"page":19},"Models","/models","2.models",[25,30,35,40,45,50,55],{"title":26,"path":27,"stem":28,"icon":29},"Defining Models","/models/defining-models","2.models/1.defining-models","i-lucide-database",{"title":31,"path":32,"stem":33,"icon":34},"Retrieving Models","/models/retrieving","2.models/2.retrieving","i-lucide-database-search",{"title":36,"path":37,"stem":38,"icon":39},"Inserting & Updating Models","/models/inserting-and-updating","2.models/3.inserting-and-updating","i-lucide-between-horizontal-start",{"title":41,"path":42,"stem":43,"icon":44},"Deleting Models","/models/deleting","2.models/4.deleting","i-lucide-trash",{"title":46,"path":47,"stem":48,"icon":49},"Relationships","/models/relationships","2.models/5.relationships","i-lucide-share-2",{"title":51,"path":52,"stem":53,"icon":54},"Events","/models/events","2.models/6.events","i-lucide-bell",{"title":56,"path":57,"stem":58,"icon":59},"Migrations & Seeders","/models/migrations-and-seeders","2.models/7.migrations-and-seeders","i-lucide-wrench",{"title":61,"path":62,"stem":63,"children":64,"page":19},"Contributing","/contributing","3.contributing",[65],{"title":66,"path":67,"stem":68},"Local Development","/contributing/local-development","3.contributing/1.local-development",{"id":70,"title":10,"body":71,"description":296,"extension":297,"links":298,"meta":299,"navigation":300,"path":11,"seo":301,"stem":12,"__hash__":302},"docs/1.getting-started/1.introduction.md",{"type":72,"value":73,"toc":293},"minimark",[74,92,101,199,204,207,210,213,261,270,277,283,289],[75,76,77,78,85,86,91],"p",{},"Vasta is a type-safe Node Object Relational Mapper (ORM) layer for ",[79,80,84],"a",{"href":81,"rel":82},"https://kysely.dev/",[83],"nofollow","Kysely"," with syntax and usage inspired by ",[79,87,90],{"href":88,"rel":89},"https://laravel.com/docs/12.x/eloquent",[83],"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.",[75,93,94,95,100],{},"Vasta provides an ",[79,96,99],{"href":97,"rel":98},"https://en.wikipedia.org/wiki/Active_record_pattern",[83],"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.",[102,103,108],"pre",{"className":104,"code":105,"language":106,"meta":107,"style":107},"language-js shiki shiki-themes material-theme-lighter material-theme material-theme-palenight","const pet = await Pet.findOrFail(1);\npet.name = \"Fluffy\";\nawait pet.save();\n","js","",[109,110,111,155,180],"code",{"__ignoreMap":107},[112,113,116,120,124,128,132,135,138,142,145,149,152],"span",{"class":114,"line":115},"line",1,[112,117,119],{"class":118},"spNyl","const",[112,121,123],{"class":122},"sTEyZ"," pet ",[112,125,127],{"class":126},"sMK4o","=",[112,129,131],{"class":130},"s7zQu"," await",[112,133,134],{"class":122}," Pet",[112,136,137],{"class":126},".",[112,139,141],{"class":140},"s2Zo4","findOrFail",[112,143,144],{"class":122},"(",[112,146,148],{"class":147},"sbssI","1",[112,150,151],{"class":122},")",[112,153,154],{"class":126},";\n",[112,156,158,161,163,166,168,171,175,178],{"class":114,"line":157},2,[112,159,160],{"class":122},"pet",[112,162,137],{"class":126},[112,164,165],{"class":122},"name ",[112,167,127],{"class":126},[112,169,170],{"class":126}," \"",[112,172,174],{"class":173},"sfazB","Fluffy",[112,176,177],{"class":126},"\"",[112,179,154],{"class":126},[112,181,183,186,189,191,194,197],{"class":114,"line":182},3,[112,184,185],{"class":130},"await",[112,187,188],{"class":122}," pet",[112,190,137],{"class":126},[112,192,193],{"class":140},"save",[112,195,196],{"class":122},"()",[112,198,154],{"class":126},[200,201,203],"h2",{"id":202},"type-safety","Type Safety",[75,205,206],{},"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.",[75,208,209],{},"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.",[75,211,212],{},"For example:",[102,214,218],{"className":215,"code":216,"language":217,"meta":107,"style":107},"language-ts shiki shiki-themes material-theme-lighter material-theme material-theme-palenight","await Pet.where(\"name\", \"Zuko\").firstOrFail();\n","ts",[109,219,220],{"__ignoreMap":107},[112,221,222,224,226,228,231,233,235,238,240,243,245,248,250,252,254,257,259],{"class":114,"line":115},[112,223,185],{"class":130},[112,225,134],{"class":122},[112,227,137],{"class":126},[112,229,230],{"class":140},"where",[112,232,144],{"class":122},[112,234,177],{"class":126},[112,236,237],{"class":173},"name",[112,239,177],{"class":126},[112,241,242],{"class":126},",",[112,244,170],{"class":126},[112,246,247],{"class":173},"Zuko",[112,249,177],{"class":126},[112,251,151],{"class":122},[112,253,137],{"class":126},[112,255,256],{"class":140},"firstOrFail",[112,258,196],{"class":122},[112,260,154],{"class":126},[75,262,263,264,266,267,269],{},"In this example, the ",[109,265,230],{}," 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 ",[109,268,237],{}," is a string column, you cannot pass a number as the value.",[75,271,272],{},[273,274],"img",{"alt":275,"src":276},"Example of autocomplete showing the valid column names","/img/content/1.getting-started/column-autocomplete.png",[75,278,279],{},[273,280],{"alt":281,"src":282},"Example type safety not allowing invalid columns, and a type error when an invalid column is entered","/img/content/1.getting-started/invalid-column.png",[75,284,285],{},[273,286],{"alt":287,"src":288},"Example type safety not allowing values, and a type error when an invalid value is entered","/img/content/1.getting-started/invalid-value.png",[290,291,292],"style",{},"html pre.shiki code .spNyl, html code.shiki .spNyl{--shiki-light:#9C3EDA;--shiki-default:#C792EA;--shiki-dark:#C792EA}html pre.shiki code .sTEyZ, html code.shiki .sTEyZ{--shiki-light:#90A4AE;--shiki-default:#EEFFFF;--shiki-dark:#BABED8}html pre.shiki code .sMK4o, html code.shiki .sMK4o{--shiki-light:#39ADB5;--shiki-default:#89DDFF;--shiki-dark:#89DDFF}html pre.shiki code .s7zQu, html code.shiki .s7zQu{--shiki-light:#39ADB5;--shiki-light-font-style:italic;--shiki-default:#89DDFF;--shiki-default-font-style:italic;--shiki-dark:#89DDFF;--shiki-dark-font-style:italic}html pre.shiki code .s2Zo4, html code.shiki .s2Zo4{--shiki-light:#6182B8;--shiki-default:#82AAFF;--shiki-dark:#82AAFF}html pre.shiki code .sbssI, html code.shiki .sbssI{--shiki-light:#F76D47;--shiki-default:#F78C6C;--shiki-dark:#F78C6C}html pre.shiki code .sfazB, html code.shiki .sfazB{--shiki-light:#91B859;--shiki-default:#C3E88D;--shiki-dark:#C3E88D}html .light .shiki span {color: var(--shiki-light);background: var(--shiki-light-bg);font-style: var(--shiki-light-font-style);font-weight: var(--shiki-light-font-weight);text-decoration: var(--shiki-light-text-decoration);}html.light .shiki span {color: var(--shiki-light);background: var(--shiki-light-bg);font-style: var(--shiki-light-font-style);font-weight: var(--shiki-light-font-weight);text-decoration: var(--shiki-light-text-decoration);}html .default .shiki span {color: var(--shiki-default);background: var(--shiki-default-bg);font-style: var(--shiki-default-font-style);font-weight: var(--shiki-default-font-weight);text-decoration: var(--shiki-default-text-decoration);}html .shiki span {color: var(--shiki-default);background: var(--shiki-default-bg);font-style: var(--shiki-default-font-style);font-weight: var(--shiki-default-font-weight);text-decoration: var(--shiki-default-text-decoration);}html .dark .shiki span {color: var(--shiki-dark);background: var(--shiki-dark-bg);font-style: var(--shiki-dark-font-style);font-weight: var(--shiki-dark-font-weight);text-decoration: var(--shiki-dark-text-decoration);}html.dark .shiki span {color: var(--shiki-dark);background: var(--shiki-dark-bg);font-style: var(--shiki-dark-font-style);font-weight: var(--shiki-dark-font-weight);text-decoration: var(--shiki-dark-text-decoration);}",{"title":107,"searchDepth":157,"depth":157,"links":294},[295],{"id":202,"depth":157,"text":203},"Learn about Vasta","md",null,{},{"icon":13},{"title":10,"description":296},"x6hXfR25DILRmb9FvQ2c5tPXDzkSCawBjGeu_-ufPeU",[298,304],{"title":15,"path":16,"stem":17,"description":305,"icon":18,"children":-1},"Get started with Vasta.",1778782558118]