# How ViteHub works

ViteHub connects your server code to your host's resources. You choose
features in your configuration and call their server APIs. The build prepares
the routes, bindings, and files your host needs.

## Server features belong to your application

A Server Primitive is an API for one server feature, such as KV, Database,
Blob, or Queue. Call it directly from a route. You do not need an Agent.

For example, a settings route reads a value with `kv.get()`. Locally, KV can
use a local store. On Cloudflare, the same route can use a Workers KV binding.
Configuration selects the provider; the import stays the same. Provider limits
still apply, and each package lists them on its host and error pages.

See it work in [your first Server Primitive](https://vitehub.dev/docs/getting-started/first-server-primitive).

## Definitions give state and work a name

Some features need a Definition file. A Queue Definition declares the
background job handler. An Agent Definition declares what an Agent can do.
ViteHub finds these files and names them by location.

Your code calls the named feature, not generated provider files. Read
[Definition discovery](https://vitehub.dev/docs/development/definition-discovery) when you add a
Definition or need to check its name.

## Agents use the same server features

An Agent is a named actor that runs instructions through a model, a coding
provider, or your code. An Invocation is one run of that Agent.

A Capability gives the Agent one selected operation. A KV Capability can let a
support Agent read settings while your app still calls KV directly. Add only
the operations the Agent needs. Your server decides who can invoke it and
which resources it can access.

Follow [your first Agent](https://vitehub.dev/docs/getting-started/first-agent), then read
[Capabilities](https://vitehub.dev/docs/agents/capabilities) and
[Invocations](https://vitehub.dev/docs/agents/invocations) as you add behavior.

## Choose the next page by your task

Each product has a tutorial, task guides, and an API reference. Detailed
topics live with the feature that owns them:

- [Workspaces and Sources](https://vitehub.dev/docs/workspace/concepts) explain writable files and read-only mounts.
- [Invoker identity](https://vitehub.dev/docs/agents/invokers) explains the trusted caller of an Agent run.
- [Runtime policy](https://vitehub.dev/docs/agents/runtime-policy) explains approval decisions and recorded events.
- [Frameworks and hosts](https://vitehub.dev/docs/frameworks-hosts) explains deployment configuration.

Browse [Learn](https://vitehub.dev/learn) to pick a result to build, or use the
[documentation catalog](https://vitehub.dev/docs) to find an API.

<!-- vitehub-docs:section-links -->
## In this section

- [Get started](https://vitehub.dev/raw/docs/getting-started.md)
- Next steps
  - [Server Primitives](https://vitehub.dev/raw/docs/getting-started/server-primitives.md)
  - [How ViteHub works](https://vitehub.dev/raw/docs/getting-started/concepts.md) (this page)
- [Develop and deploy](https://vitehub.dev/raw/docs/getting-started/migrate-from-nuxthub.md)
- [Coding agents](https://vitehub.dev/raw/docs/getting-started/ai-resources.md)

Next: [Build and deploy](https://vitehub.dev/raw/docs/getting-started/build-and-deploy.md)

All pages: [llms.txt](https://vitehub.dev/llms.txt)
