# Local development

Use this section to run a ViteHub app 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/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/console) | Discovered Agents, retained sessions, invocation events, and stored data | [console.vitehub.dev](https://console.vitehub.dev), which calls your app |
| [Generated files](https://vitehub.dev/docs/development/generated-files) | Registries, generated types, Provision State, and host output | `.vitehub/**` and the host's output folder |
| [Bundle reports](https://vitehub.dev/docs/bundle) | Client and server size, startup code, and why each package is in a production build | `vitehub bundle` and `.vitehub/bundle/` |
| [Application tests](https://vitehub.dev/docs/development/testing) | Server API behavior and app regressions with `vite-hub/test` | Test output |

## Run the local app

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

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

When discovery works, run the app'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 output
```

Use [`vitehub agent dev`](https://vitehub.dev/docs/cli/agents#talk-to-an-agent-during-development) to talk to an Agent through the running dev server. Open the app in the [Console](https://vitehub.dev/docs/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 --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

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

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

- Build state
  - [Local development](https://vitehub.dev/raw/docs/development.md) (this page)
  - [Provisioning](https://vitehub.dev/raw/docs/development/provisioning.md)
  - [Definition discovery](https://vitehub.dev/raw/docs/development/definition-discovery.md)
  - [Vite integrations and Provider Output](https://vitehub.dev/raw/docs/development/integrations-and-output.md)
  - [Generated files](https://vitehub.dev/raw/docs/development/generated-files.md)
- [Proof and recovery](https://vitehub.dev/raw/docs/development/testing.md)

Next: [INTERNAL_R0001](https://vitehub.dev/raw/docs/development/diagnostics/internal_r0001.md)

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