Provisioning
Provision is the ViteHub CLI workflow that creates missing provider resources required by app Definitions. Provision Steps are package-contributed, idempotent, and create-only; they never delete or mutate existing resources.
Preview the plan
Run a dry run first. The CLI loads the Vite config, collects Provision Steps from active package integrations, and prints the actions for one provider.
pnpm vitehub provision run --provider cloudflare --dry-run
pnpm vitehub provision run --provider vercel --dry-run
The output labels each action as exists or create.
A dry run does not call apply() and does not write Provision State.
create d1-database app-content
exists r2-bucket uploads
Apply the plan
Set provider credentials only when you want the CLI to apply actions. Cloudflare and Vercel use different credential sets.
CLOUDFLARE_ACCOUNT_ID=... CLOUDFLARE_API_TOKEN=... pnpm vitehub provision run --provider cloudflare
VERCEL_TOKEN=... VERCEL_TEAM_ID=... pnpm vitehub provision run --provider vercel
After a successful apply, the CLI writes non-secret ids to .vitehub/provision.json.
Vite Integrations may read that file as a binding-id source during dev or build.
{
"cloudflare": {
"d1": {
"default": "database-id"
}
}
}
Resource ownership
| Owner | Responsibility |
|---|---|
| ViteHub CLI | Loads Vite config, collects Provision Steps, validates provider credentials, and writes Provision State. |
| Primitive package | Plans and applies resources for the primitive it owns. |
| Provider | Owns cloud resources, credentials, and existing-resource lookup behavior. |
| Vite Integration | Reads Provision State when generated Provider Output needs resource ids. |
Production boundary
Provision is not a build step. Builds may read Provision State, but they must not create provider resources.
.vitehub/provision.json unless a project deliberately decides that non-secret provider ids belong in source control. The root repository ignores .vitehub/** by default.Next steps
- Use Provider output to understand generated host artifacts.
- Use Cloudflare or Vercel for host boundaries.
- Use Troubleshooting for credential and output failures.