Skip to content

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.

Vox’s marquee product experience is going from an empty directory to a deployed application in under 10 minutes.

Terminal window
# 1. Generate the TanStack Start and Rust scaffolding
vox new web my-app
# 2. Change into the directory
cd my-app
# 3. Deploy instantly (requires flyctl installed and authenticated)
vox deploy --target fly

This golden path guarantees the fastest iteration cycle for a solo developer building web applications.

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"
}

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.

Before pushing images to a private registry, authenticate with vox login:

Terminal window
# Log in to the default VoxPM registry
vox 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 Hub
vox login <password> --registry registry.hub.docker.com --username myuser

Credentials are stored in ~/.vox/auth.json. When you run vox deploy, the CLI will automatically authenticate with the configured registry before pushing.

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.

Vox.toml
[deploy]
target = "fly"
[deploy.fly]
app_name = "my-app"
org = "personal"
region = "ams"

Then run:

Terminal window
vox deploy --target fly

vox deploy --target fly automatically:

  1. Detects your local flyctl installation and authentication.
  2. Packages the application using the local Vox compiler and toolchain.
  3. Automatically deploys to Fly.io using your configured application name.

Alternatively, for traditional container-based deployments:

Vox.toml
[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:

Terminal window
vox deploy --target container

vox deploy --target container automatically:

  1. Detects your container runtime (Podman preferred, Docker fallback)
  2. Builds the OCI image
  3. Authenticates with your registry using credentials from vox login
  4. Tags and pushes the image

If you prefer building yourself, Vox can build an OCI container image:

Terminal window
vox container build --tag my-vox-app
docker run -p 8080:8080 my-vox-app

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: