Deploying
Swift Rust produces a single statically-linked binary. You can deploy it anywhere Linux runs — Docker containers, bare metal, Kubernetes, or a $5 VPS.
Build for production
bun run build
# → ./target/release/swift-rust-app
# A single binary, ~12-20MB, no Node requiredRun the production server
PORT=3000 ./target/release/swift-rust-appEnvironment variables
PORT— the port to bind to (default:3000)HOST— the host to bind to (default:0.0.0.0)DATABASE_URL— and any others you load via@swift-rust/env
Docker
FROM rust:1.85-slim AS builder
WORKDIR /app
COPY . .
RUN bun install && bun run build
FROM debian:bookworm-slim
COPY --from=builder /app/target/release/swift-rust-app /usr/local/bin/app
EXPOSE 3000
CMD ["/usr/local/bin/app"]Static export
For pure static sites, set "output": "export" in your config. The build will produce anout/ directory you can upload to any static host (Cloudflare Pages, Vercel, S3, etc.).
Deploy to Vercel
Every new app from create-swift-rust ships with a vercel.jsonpreconfigured for the Swift Rust build output. To deploy:
- Push your project to a GitHub repository.
- Go to vercel.com/new and import the repo.
- Click Deploy. Vercel will run
bun run buildwhich produces.vercel/output/and serves it on the CDN.
The static export supports pre-rendered pages, 404 handling, immutable asset caching, andgenerateStaticParams for catch-all routes. Serverless functions, ISR, and Edge runtime are planned for v0.2.0.
To deploy the same project to a different provider, run bun run build locally and upload the contents of .vercel/output/static/ to any static host (Netlify, Cloudflare Pages, S3 + CloudFront, GitHub Pages).
Next steps
Continue to Migrating from Next.js if you're coming from a Next.js project.