Scaffold
A scaffold is a full CRUD interface for a resource. It includes the index, view, create and edit
pages, a schema definition and a database model. If fields isn't provided, the scaffold
will be generated based on the existing database schema.
Syntax
$ vela generate scaffold <name> [fields...] $ vela generate scaffold pets name:string age:number This will create a full CRUD interface for the pets resource at /pets, the database
model and Zod schema definition, and the database migration file.
The files created are:
src/routes/pets/+page.svelte
src/routes/pets/+page.server.ts
src/routes/pets/new/+page.svelte
src/routes/pets/new/+page.server.ts
src/routes/pets/[id]/+page.svelte
src/routes/pets/[id]/+page.server.ts
src/routes/pets/[id]/edit/+page.svelte
src/routes/pets/[id]/edit/+page.server.ts
src/lib/schemas/pet.ts
migrations/created_pets.ts
AI
ProThe generate scaffold command supports the --ai option for freeform text input in place
of specifying the fields.
$ vela generate scaffold hotels --ai "listing info for hotels"