# Generated files

Use this page to find the files that ViteHub writes during development and
builds. They show how ViteHub resolved Definitions, Runtime Registries, stable
imports, and Provider Output. Application code uses documented ViteHub imports
instead of generated files.

## Common generated paths

| Path | Owner | Purpose |
| --- | --- | --- |
| `.vitehub/types.d.ts` | ViteHub Framework | Entry that references every generated declaration file under `.vitehub`. |
| `.vitehub/env/public.mjs` | Env Package | Generated Public Env runtime module. |
| `.vitehub/env/server.mjs` | Env Package | Generated Server Env runtime module. |
| `.vitehub/types/env.d.ts` | Env Package | Generated Public Env and Server Env types. |
| `.vitehub/types/browser.d.ts` | Browser Package | Generated Browser Definition names and input/result module types. |
| `.vitehub/types/email.d.ts` | Email Package | Exact module declarations for discovered `#vitehub/emails/<name>` imports. |
| `.vitehub/types/workspace.d.ts` | Workspace Package | Generated Workspace name types. |
| `.vitehub/types/source/collections.d.ts` | Source Package | Generated Collection names and definitions. |
| `.vitehub/email/templates/*.mjs` | Email Package | Bundled Markdown email templates used by provider builds. |
| `.vitehub/rate-limit/manifest.json` | Rate Limit Package | Sorted Rate Limit IDs, resolved providers, and inspectable driver capabilities. |
| `.vitehub/nitro/realtime/registry.mjs` | Realtime Package | Generated registry for discovered Realtime Definitions. |
| `.vitehub/nitro/realtime/handler.ts` | Realtime Package | Generated WebSocket and checkpoint route handler. |
| `.vitehub/agent/chat-webhook-route.ts` | Agent Package | Generated Chat Webhook Route handler for discovered chat-capable Agents. |
| `.vitehub/agent/discord-gateway-plugin.ts` | Agent Package | Generated Nitro process lifecycle for Discord Gateway listeners on the Node preset. |
| `.vitehub/agent/discord-gateway-route.ts` | Agent Package | Generated Nitro route handler that wakes the Discord Gateway listener for discovered Discord Agents. |
| `.vitehub/agent/deno-server.ts` | Agent Package | Standalone Deno server for Agent chat and webhook routes. Written only when the Agent integration sets `runtime: 'deno'`. The `deno` preset serves Agent routes from the Nitro server instead. |
| `.vitehub/schedule/deno-cron.mjs` | Schedule Package | Deno `Deno.cron` wake output for Static Schedule Definitions. |
| `.vitehub/nitro/schedule/*` | Schedule Package | Narrow Nitro bridge for Schedule Provider Wake. |
| `.vitehub/provision.json` | ViteHub CLI | Non-secret Provision State read by Vite Integrations. |
| `.output/server/index.mjs` | Provider Output | Server entry for the `node`, `cloudflare`, and `deno` presets. |
| `.output/server/wrangler.json` | Provider Output | Cloudflare Worker config written by a `cloudflare` preset build. |
| `.vercel/output/**` | Provider Output | Vercel Build Output written by a `vercel` preset build. |
| `.netlify/v1/functions/**` | Provider Output | Netlify Agent and static Schedule functions generated by their package integrations. |

The `.vitehub/agent/**` paths above are the default for Vite integrations. The Nuxt integration keeps generated Agent artifacts inside Nuxt's build directory instead, under `<buildDir>/vitehub/agent/**` (normally `.nuxt/vitehub/agent/**`). Agent Definition discovery still uses the project and server directories.

## Inspect generation

List generated host output with the CLI. It shows which files the enabled
packages and the preset write, whether each file exists, and redacts secrets.
Run a production build first.

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

List the files under `.vitehub` after Vite startup or a build. The exact set
depends on the enabled features and the preset.

```bash [Terminal]
find .vitehub -maxdepth 4 -type f | sort
```

For Nuxt, inspect the framework-owned generated directory instead.

```bash [Terminal]
find .nuxt/vitehub -maxdepth 4 -type f | sort
```

Inspect resolved Rate Limit guarantees before deployment. The manifest uses `schemaVersion: 2` and contains sorted `rateLimits` entries with `name`, `provider`, and `capabilities`; it is generated state for agents and tooling, not an application import.

```bash [Terminal]
cat .vitehub/rate-limit/manifest.json
```

Inspect env aliases through the stable import paths.
The generated files are implementation details behind those imports.

```ts [server/config.ts]
import { useServerEnv } from '#vitehub/env/server'

const env = useServerEnv()
```

## Regenerate after edits

Vite Integrations refresh generated files during dev startup, hot updates, or build hooks depending on the package.
Restart the Vite dev server when a generated file does not match the current Definition set.

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

## Troubleshooting

| Symptom | Likely cause | Fix |
| --- | --- | --- |
| Stable import does not resolve | Generated type path is missing from TypeScript includes, or the Vite Integration did not run. | Add `.vitehub/types/**/*.d.ts` to `tsconfig.json` and restart Vite. |
| Generated registry is empty | Discovery path does not match the package file convention. | Check [File conventions](https://vitehub.dev/docs/reference/file-conventions). |
| Provider output is stale | Build skipped provider output during dev or e2e mode. | Run a production-shaped build. |
| Provision ids are missing | Provision State was never written, or env vars override it. | Run `vitehub provision run --dry-run`, then apply with credentials if needed. |

## Next steps

- Use [Import paths](https://vitehub.dev/docs/reference/import-paths) for public import boundaries.
- Use [Provider output](https://vitehub.dev/docs/reference/provider-output) for host artifacts.
- Use [Runtime and host support](https://vitehub.dev/docs/frameworks-hosts/support-matrix) for qualified host coverage.
- Use [File conventions](https://vitehub.dev/docs/reference/file-conventions) for discovery rules.
