How-To: Deploy to Production
Learn how to package and deploy your Vox application using declarative environments, the vox deploy command, and Fly.io for zero-configuration deployments. For complete command syntax and target configurations, see the vox deploy CLI reference.
The Golden Path: Zero to Production
Section titled “The Golden Path: Zero to Production”Vox’s marquee product experience is going from an empty directory to a deployed application in under 10 minutes.
# 1. Generate the TanStack Start and Rust scaffoldingvox new web my-app
# 2. Change into the directorycd my-app
# 3. Deploy instantly (requires flyctl installed and authenticated)vox deploy --target flyThis golden path guarantees the fastest iteration cycle for a solo developer building web applications.
Declarative Environments
Section titled “Declarative Environments”You can define your deployment environment directly in your .vox files using environment blocks. This allows you to specify a base image, system packages, environment variables, exposed ports, and more.
// Note: env constructs are tombstoned. Use Dockerfile or standardized CI pipelines.fn orchestrator_staging_config() to str { return "node:22-alpine"}Bare Metal (systemd) Provider
Section titled “Bare Metal (systemd) Provider”For applications that run directly on Linux servers without Docker, set base to "bare-metal" and Vox will generate a systemd .service file instead of a Dockerfile:
type BareMetalConfig { workdir: str port: int}
fn bare_metal_server_config() to BareMetalConfig { return { workdir: "/opt/my-app", port: 8080 }}Running vox build will emit a server.service file ready for deployment with systemctl enable and systemctl start.
Vox will automatically use these blocks to generate customized OCI-compatible Dockerfiles or systemd service files.
1. Registry Authentication
Section titled “1. Registry Authentication”Before pushing images to a private registry, authenticate with vox login:
# Log in to the default VoxPM registryvox login <your-api-token>
# Log in to a private OCI registry (e.g. GitHub Container Registry)vox login <token-or-password> --registry ghcr.io --username myuser
# Log in to Docker Hubvox login <password> --registry registry.hub.docker.com --username myuserCredentials are stored in ~/.vox/auth.json. When you run vox deploy, the CLI will automatically authenticate with the configured registry before pushing.
2. Deploying with vox deploy
Section titled “2. Deploying with vox deploy”The simplest way to deploy your application is using the vox deploy command. This handles building your container image, authenticating with the registry, and pushing.
[deploy]target = "fly"
[deploy.fly]app_name = "my-app"org = "personal"region = "ams"Then run:
vox deploy --target flyvox deploy --target fly automatically:
- Detects your local
flyctlinstallation and authentication. - Packages the application using the local Vox compiler and toolchain.
- Automatically deploys to Fly.io using your configured application name.
Alternatively, for traditional container-based deployments:
[deploy]target = "container"image_name = "my-registry.io/my-vox-app"registry = "my-registry.io"runtime = "podman" # optional: docker or podman (auto-detected if omitted)Then run:
vox deploy --target containervox deploy --target container automatically:
- Detects your container runtime (Podman preferred, Docker fallback)
- Builds the OCI image
- Authenticates with your registry using credentials from
vox login - Tags and pushes the image
3. Manual Packaging
Section titled “3. Manual Packaging”If you prefer building yourself, Vox can build an OCI container image:
vox container build --tag my-vox-appdocker run -p 8080:8080 my-vox-app4. Persistent Storage
Section titled “4. Persistent Storage”Since Vox uses SQLite for the data layer and durability journal, ensure you mount a persistent volume if deploying as a container.
# fly.toml example[mounts] source = "vox_data" destination = "/data"Related Reference:
- Fullstack Artifacts — Rust-first containers vs Express
server.ts. - CLI Reference — All
vox containerandvox deployoptions. - Runtime Explanation — Understanding the runtime environment.