Skip to content
TypeScript
7.5 KB
Raw Blame
---
title: Websites
description: Deploy Vite, Astro, Next.js, vinext, Nuxt, React Router, SolidStart, SvelteKit, TanStack Start, Waku, Octane, Foldkit, Vocs, or any static build to Fly with first-class Website resources.
sidebar:
  label: Overview
  order: 1
---

Alchemy deploys frontends to Fly with a family of `Fly.Website`
resources. Each one builds your project programmatically and
deploys it as a Node [Service](/fly/compute/services) on a Fly
[App](/fly/compute/apps) — a Machine listening on port 3000, plus
a shared IPv4 so `https://{app}.fly.dev` answers — with no
`fly.toml` and no adapter to put in the framework config. Your
framework's own config file (`vite.config.ts`, `astro.config.*`,
`nuxt.config.ts`, ...) loads natively; Alchemy layers its Node
container integration on top.

- [`Vite`](/fly/frontend/vite) — client-only Vite apps (React,
  Vue, Solid SPAs, `index.html` multi-page sites); a tiny
  static-file server serves the `vite build` output.
- [`Astro`](/fly/frontend/astro) — Astro sites, server-rendered
  on Node or fully static; your `astro.config.*` loads natively.
- [`Nextjs`](/fly/frontend/nextjs) — Next.js as a long-running
  Node process (`next build`, then `next({ dev: false })`). Not
  OpenNext.
- [`Vinext`](/fly/frontend/vinext) — vinext (Next.js API on Vite)
  as a long-running Node process (`vinext build`, then
  `startProdServer`). Not the Cloudflare Worker path.
- [`Nuxt`](/fly/frontend/nuxt) — Nuxt apps through nitro's Node
  server; your `nuxt.config.ts` loads natively. Do not set
  `nitro.preset`.
- [`ReactRouter`](/fly/frontend/react-router) — React Router v8 in
  framework mode, built through your own `vite build`.
- [`SolidStart`](/fly/frontend/solidstart) — SolidStart 2.x SSR;
  Alchemy appends nitro's `node` preset to your `vite build`.
- [`SvelteKit`](/fly/frontend/sveltekit) — SvelteKit SSR plus
  prerendered assets; the Node adapter is injected. Do not set
  `kit.adapter`.
- [`TanStackStart`](/fly/frontend/tanstack-start) — TanStack Start
  (React or Solid), built through your own `vite build`.
- [`Waku`](/fly/frontend/waku) — Waku (React Server Components)
  on Node, with SSG pages served extensionless.
- [`Octane`](/fly/frontend/octane) — OctaneJS SSR. Alchemy wraps
  native Node output; no hosting adapter is needed in `octane.config.ts`.
- [`Foldkit`](/fly/frontend/foldkit) — Foldkit SPA, SSR, and prerendered apps;
  browser-only deep links fall back to `index.html`.
- [`Vocs`](/fly/frontend/vocs) — prerendered Vocs docs; extensionless
  pages (`/about` → `about/index.html`).
- [`StaticSite`](/fly/frontend/static-site) — any build command's
  output directory (Hugo, Zola, Eleventy).

Each resource creates a `Fly.App` when you omit `app`, a
`Fly.Service` on port 3000, and a `shared_v4`
[`IpAssignment`](/fly/networking) so `{app}.fly.dev` answers.
`domain` requests ACME via [`Certificate`](/fly/networking#use-your-own-hostname)
(existing DNS only for v1); `url` becomes `https://{domain}`.
The return is `{ url, app, service, ip, certificate }` —
everything except `url` is `undefined` under `alchemy dev`.

Shared props: `rootDir`, `memo`, `env` (Machine process
environment — not Worker bindings), `dev`, `domain`, `app`.
Builds are memoized by content-hashing the input files — an
unchanged project skips the build.

## What's supported

| Framework | Resource | Guide |
| --- | --- | --- |
| React / Vue / Solid SPA | `Vite` | [Vite](/fly/frontend/vite) |
| TanStack Start (React & Solid) | `TanStackStart` | [TanStack Start](/fly/frontend/tanstack-start) |
| React Router | `ReactRouter` | [React Router](/fly/frontend/react-router) |
| SolidStart | `SolidStart` | [SolidStart](/fly/frontend/solidstart) |
| Astro | `Astro` | [Astro](/fly/frontend/astro) |
| Next.js | `Nextjs` | [Next.js](/fly/frontend/nextjs) |
| vinext | `Vinext` | [vinext](/fly/frontend/vinext) |
| Nuxt | `Nuxt` | [Nuxt](/fly/frontend/nuxt) |
| SvelteKit | `SvelteKit` | [SvelteKit](/fly/frontend/sveltekit) |
| Waku | `Waku` | [Waku](/fly/frontend/waku) |
| OctaneJS | `Octane` | [Octane](/fly/frontend/octane) |
| Foldkit | `Foldkit` | [Foldkit](/fly/frontend/foldkit) |
| Vocs | `Vocs` | [Vocs](/fly/frontend/vocs) |
| Zola, Hugo, or any static generator | `StaticSite` | [Static sites](/fly/frontend/static-site) |

See
[examples/fly-website-vite](https://github.com/alchemy-run/alchemy/tree/main/examples/fly-website-vite)
for a Vite SPA next to a Fly Service API.

## How to choose

Use the resource named after your framework. `Astro`, `Nextjs`,
`Nuxt`, `ReactRouter`, `SolidStart`, `SvelteKit`,
`TanStackStart`, `Waku`, `Octane`, `Foldkit`, and `Vocs` each
drive that framework's programmatic build and know its output
layout, config surface, and dev server.

Use `Vite` when the whole deployable output is static assets — a
React, Vue, or Solid SPA, or an `index.html`-per-route multi-page
app. SSR frameworks that wrap Vite (`Astro`, `SvelteKit`,
`Octane`, …) have their own resources; `Vite` never starts a
framework server module.

Use `StaticSite` when the build is an arbitrary shell command
that emits a directory of files.

## Environment variables

Top-level `env` is copied onto `process.env` before build and
dev, and onto the Machine at deploy. Client inlining is whatever
the framework already does (`VITE_*` for Vite). It is not Worker
bindings and not AWS `server.environment`.

```typescript
const site = yield* Fly.Website.Vite("Web", {
  env: {
    VITE_API_URL: api.url,
  },
});
```

Server code reads `process.env`. Pair a site with
[Postgres](/fly/data/postgres) the same way you would any other
Service: put the connection string in `env`, or bind
`ConnectPostgres` on a sibling [Service](/fly/compute/services).

## Local development

`alchemy dev` runs the framework's own dev server (native HMR)
instead of deploying. `site.url` is the local address and no Fly
App, Service, IP, or certificate is created. Wrap the site in
`Alchemy.remote()` to deploy the live path even during dev.

## Custom domain

```typescript
const site = yield* Fly.Website.Astro("Web", {
  domain: "app.example.com",
});
```

A hostname string makes Alchemy request ACME on the App; you point DNS
at the App yourself. `url` becomes `https://app.example.com`.

To have Alchemy publish the records, pass the DNS host as `dns`. The site
then publishes the ACME challenge `CNAME` and the `A`/`AAAA` records at the
App through that host:

```typescript
const site = yield* Fly.Website.Astro("Web", {
  domain: { name: "app.example.com", dns: Cloudflare.DNS.Adapter() },
});
```

`AWS.Route53.Adapter()` and `Hetzner.DNS.Adapter()` work the same way. See
[DNS Adapters](/infrastructure-as-code/dns-adapters).

## Where next

- [The Vite resource](/fly/frontend/vite) — assets-only SPA,
  `assets.notFoundHandling`, env inlining.
- [The StaticSite resource](/fly/frontend/static-site) — build
  commands, SPA/404 handling.
- Framework guides:
  [Astro](/fly/frontend/astro),
  [Next.js](/fly/frontend/nextjs),
  [Nuxt](/fly/frontend/nuxt),
  [React Router](/fly/frontend/react-router),
  [SolidStart](/fly/frontend/solidstart),
  [SvelteKit](/fly/frontend/sveltekit),
  [TanStack Start](/fly/frontend/tanstack-start),
  [Waku](/fly/frontend/waku),
  [Octane](/fly/frontend/octane),
  [Foldkit](/fly/frontend/foldkit),
  [Vocs](/fly/frontend/vocs).
- [Services](/fly/compute/services) — the Node process these
  resources deploy.
- [Postgres](/fly/data/postgres) — managed Postgres next to a
  site.
- [`Vite` reference](/providers/fly/website/vite),
  [`Astro` reference](/providers/fly/website/astro),
  [`StaticSite` reference](/providers/fly/website/staticsite).