Push your Claude Code code to GitHub, import the repo on Fly.io, build with From package.json / Dockerfile, add your
environment variables before the first build, add the nginx.conf refresh fallback, allow the new
URL in your auth provider, then connect your domain. Fly.io: No free tier — $1 trial credit, no card, for 7 days or until spent; paid from ≈$2.19/mo
(checked 20 Nov 2026).
- Ask Claude Code to write a Dockerfile, then run fly launch from the project folder.
Step by step
-
Check your project type
- Static / SPA: Build outputs dist/, build/ or out/.
- Server app / API / bot: Has a start command that keeps running, often a Dockerfile.
-
Get the code onto GitHub
- Ask it to initialise git and create a GitHub repo, or run git init / git push yourself.
-
Create the project on Fly.io
Install flyctl, run
fly launchin the project folder (it detects a Dockerfile or framework), thenfly deployfor later updates. -
Check the build settings
A Vite SPA is typically built in a Docker stage and served by nginx on port 80 (set internal_port in fly.toml).
For Claude Code: build command
From package.json / Dockerfile, output Depends on framework. -
Add environment variables before the first build
In Fly.io:
fly secrets set NAME=valuefor runtime secrets; build-timeVITE_*values must be passed as build args. Copy these from Claude Code:-
Everything in .env — add each value in the host dashboard.
Changed a value later? Rebuild. Vite bakes variables in at build time. Troubleshoot missing env vars
-
-
Make page refreshes work (Vite / React Router single-page apps served by nginx)
nginx.conf location / { try_files $uri $uri/ /index.html; }Server-rendered projects (TanStack Start, Next.js) don't need this. Fly.io docs (opens in a new tab)
-
Update login redirect URLs
Add your new Fly.io URL (and later your custom domain) to your auth provider's allowed URLs. Redirect troubleshooting
-
Add your domain
fly certs add yourdomain.com, then create the A/AAAA (or CNAME) records flyctl prints.
How much does Fly.io cost for a Claude Code app?
Trial only No free tier — $1 trial credit, no card, for 7 days or until spent. Paid from ≈$2.19/mo: Pay-as-you-go: shared-cpu-1x · 256 MB is $2.19/month in Ashburn (iad); region multipliers apply. Managed Postgres from $38/month. Checked 20 Nov 2026 on Fly.io's pricing page (opens in a new tab).
- Needs the flyctl CLI and usually a Dockerfile — not the lowest-friction choice for non-developers.
Other options for Claude Code
- Claude Code → Vercel
- Claude Code → Cloudflare Pages
- Claude Code → Railway
- Claude Code → Render
- Claude Code → DigitalOcean App Platform
Errors to watch for on Fly.io
Related guides
- Custom domain on Lovable, Bolt, Replit and v0: what it costs and how to set it up
- Supabase vs Neon vs Firebase vs Turso: which database for an AI-built app?
- Supabase “permission denied for table” (42501) on a new table: the October 30 grants change, explained and fixed
- Vercel Hobby Data Cache moves to Runtime Cache on 29 November 2026: what changes and what to do
- Netlify Server (Early Access, November 2026): run an Express, Hono or Fastify backend and WebSockets on Netlify
- Supabase CLI v3 (November 2026): why db push no longer reaches your project, and how to fix HostedMutationConsentRequiredError
- Cloudflare spending limits (November 2026): how to put a hard cap on your Workers bill, and what stops when you hit it
- Vercel Security Review (November 2026): what it scans, what it costs per push, and how to keep it from reviewing every repo
- Vercel build minutes (November 2026): Pro teams now pay for Standard builds, what a build costs, and how to build less
- vercel.toml on Vercel (November 2026): how to convert vercel.json, with SPA rewrites, branches and the one-file rule
- Vercel 413 FUNCTION_PAYLOAD_TOO_LARGE: the 4.5 MB request body limit, the new 20 MiB opt-in (Nov 2026), and when to upload straight to storage
- Cloudflare Email Sending on the Workers Free plan (November 2026): what you can send for free, what needs the $5 plan, and how to set it up
- Cloudflare Search for Agents (November 2026): what the toggle does, what it costs from 1 December, and how to set it up safely
- Claude Sonnet 4.5 retires on 30 November 2026: find the calls in your vibe-coded app and switch without new 400 errors