Global SvelteKit Apps Without the Headache

Fly.io is a developer-focused public cloud with all the right features to make your SvelteKit app just work.

Launch Now

Ready, Set, Go!

Speedrun Your SvelteKit App Onto Fly.io

Deploy your SvelteKit app, batteries included, on Fly.io with just a few commands.

Get Started
> Install flyctl on GNU/Linux
curl -L https://fly.io/install.sh | sh
 
> Create a SvelteKit app
npm create svelte@latest fly-speedrun
 
> Switch to the node adapter
npm i -D @sveltejs/adapter-node
sed -i '' 's/auto/node/g' svelte.config.js
 
> From the root of your app
fly launch
 
> Scale outwards and upwards
fly scale

Not on GNU/Linux? Install flyctl for your platform.

Just Works Deployment for Your SvelteKit App

SvelteKit comes out of the box with SSR, CORS, CSRF and XSS protection. Fly.io comes out of the box with HTTP/2, TLS and load balancing. A match made in heaven?

Breaking the Speed of Light, for the Benefit of All

When using SSR with SvelteKit, the speed of light is the limit. Defeat that limit by locating your app near your users, and let them reap the benefits of low response times. Fly.io’s global proxy makes it easy.

AI-Powered Development

Build SvelteKit Apps with AI Agents

Choose from the leading AI agents for SvelteKit development. Each brings unique strengths to help you build faster and deploy seamlessly on Fly.io.

NEW!

Managed Postgres That Just Works

Add a fully-managed database to your Sveltekit project. Fly.io will take care of:

  • Automatic backups and recovery
  • High availability with automatic failover
  • Performance monitoring and metrics
  • Resource scaling (CPU, RAM, storage)
  • 24/7 support and incident response
  • Automatic encryption of data at rest and in transit
Learn More
  • Globally Distributed S3-Compatible Storage With Tigris

    Working with files? Fly.io apps can access Tigris, a global, S3-compatible object store with automatic caching. It intelligently co-locates data with your users so latency stays low and bandwidth is maximized.

  • Supabase Managed PostgreSQL

    Need a database? No problem. You can use your favourite ORM to plug into Supabase’s managed PostgreSQL right from your Fly.io app.

  • Metrics, Redis & More

    Fly.io also bundles Grafana for metrics, Upstash Redis and LiteFS cloud for replicated SQLite.

Attach Managed Postgres to your SvelteKit app

Managed Postgres is the supported path. Fly.io runs the cluster for you, handling automatic backups and recovery, high availability with automatic failover, performance monitoring, resource scaling, and encryption of data at rest and in transit. Provision it as part of the launch:

fly launch --db mpg

Or add one to an app that already exists, in two commands:

fly mpg create
fly mpg attach <clusterID> -a your-app-name

fly mpg attach writes the connection string onto the app as a secret named DATABASE_URL and triggers a deploy so the app comes up holding it. The string is the pooled connection URL, which goes through PgBouncer. You never see the password. Your app needs @sveltejs/adapter-node either way, because the auto adapter does not produce a server build that can be run directly.

To use it, read it through $env/dynamic/private, which resolves at runtime, rather than $env/static/private, which is inlined at build time when the secret is not there yet.

Migrations run on every deploy through release_command, which whichever migration command your ORM uses:

[deploy]
  release_command = "npm run migrate"

It runs in a temporary Machine built from the new image, with your secrets loaded, before any Machine takes traffic. A non-zero exit fails the deploy and the previous version keeps serving.

What you didn't have to set up

Look back at what actually happened. You ran fly launch, and either took the database with it or added it with fly mpg create and fly mpg attach. A standard SvelteKit app with a Postgres database in one region is the ordinary case Fly.io is built for, not a stretch. Here is the work that never appeared:

A hosting service for your code. fly launch and fly deploy build from the directory you are standing in. A SvelteKit project with no git remote at all deploys fine.

A Dockerfile. fly launch detects SvelteKit and writes the Dockerfile. It lands in your repository where you can read it, edit it, and see it in a diff.

A connection string. Attaching writes DATABASE_URL onto the app as a secret. The password never lands in your clipboard or your shell history.

A migration step in a deploy pipeline. release_command runs migrations on a throwaway Machine before any Machine takes traffic. A migration that fails fails the deploy, instead of half migrating production.

TLS and a hostname. The app answers on <app>.fly.dev with HTTPS from the first request, and the certificate is issued and renewed for you.

A load balancer or a VPC. Fly Proxy is already in front of your Machines, and your app reaches Postgres over your organization's private network as soon as the cluster is attached.

None of that work is missing. It is done, and the record of it is a fly.toml you can read in one screen, diff in a pull request, and revert with git.