# Local development

Use this section to run a ViteHub application on your machine and check its
behavior before you deploy it. ViteHub uses the same Vite config to discover
Definitions, write generated files, and resolve Agent metadata in development
and in production builds.

## Choose a local tool

| Tool | Use it for | Output to inspect |
| --- | --- | --- |
| Vite dev server | Definition discovery, server imports, Agent streams, and local providers | Terminal output and responses from your routes |
| [ViteHub CLI](https://vitehub.dev/docs/development/cli) | Package-owned commands such as `inspect`, `agent dev`, `agent eval`, and `provision` | Exit code, terminal output, and optional JSON |
| [ViteHub Console](https://vitehub.dev/docs/development/console) | Discovered Agents, retained sessions, invocation events, and stored data | The `/_vitehub` page in the browser |
| [Generated files](https://vitehub.dev/docs/development/generated-files) | Registries, generated types, Provision State, and host output | `.vitehub/**` and the preset's output directory |
| Application tests | Server API behavior and application regressions | Test output |

## Run the local app

Start the application with its normal development command. ViteHub integrations
run during Vite startup, so discovery and generated files use the application
root.

```bash [Terminal]
pnpm dev
```

When discovery works, run the application's tests and a production build.

```bash [Terminal]
pnpm test
pnpm build
```

## Inspect what ViteHub discovered

Run `vitehub inspect` while the app is configured. It lists the Definitions that
each enabled package discovered and the host output files that a build writes.
It does not start a server or call a provider.

```bash [Terminal]
pnpm vitehub inspect definitions
pnpm vitehub inspect provider-output
```

Use [`vitehub agent dev`](https://vitehub.dev/docs/development/cli#talk-to-an-agent-during-development)
to talk to an Agent through the running dev server. Enable the
[Console](https://vitehub.dev/docs/development/console) when you need session search and
invocation events in a browser.

## Verify before deploy

Run the narrowest check that covers the behavior you changed:

- `vitehub agent eval` for Agent behavior.
- `vitehub provision run --provider <name> --dry-run` for provider resources.
- `pnpm build` when generated host output changed.

[Verification](https://vitehub.dev/docs/development/verification) explains each check and what it
does not cover.

## Next steps

- Open [CLI](https://vitehub.dev/docs/development/cli) for every command and flag.
- Open [Generated files](https://vitehub.dev/docs/development/generated-files) when a registry or host output looks wrong.
- Open [Troubleshooting](https://vitehub.dev/docs/development/troubleshooting) when a check fails.
- Open [Errors and diagnostics](https://vitehub.dev/docs/reference/errors-diagnostics) for failure families.
