# Resource

A resource is a collection of data that is stored in the database. For models that don't require a frontend interface, you can use the resource generator to create the collection and its schema. For existing models, the `fields` option can be omitted and the generator will use the existing fields.

### Syntax

```
$ vela generate resource <model> [fields...]
```

```
$ vela generate resource categories name:text
```

This will create the database collection and a Zod schema definition for the resource. The file created is:

```
src/lib/schemas/category.ts
```

The `categories` collection is created in the database and the TypeScript definitions are [synced](/sync). Unlike [scaffold](/generate/scaffold), no routes or components are generated.

### Options

`generate resource` takes no options. To design a model from a description, use [`generate scaffold --ai`](/generate/scaffold) or [`generate schema --ai`](/generate/schema). To place routes at a custom path, use [`generate scaffold --route`](/generate/scaffold).