Websites
A website on DigitalOcean runs as an App: Alchemy builds your framework app on your machine, puts its server and static files into one image, and App Platform serves it over HTTPS. Pages the framework renders on the server and files it builds ahead of time come from the same App.
- server
- Node · SSR routes
- files
- dist/client
Deploy a framework app
Section titled “Deploy a framework app”Every framework has its own resource, all taking the project’s rootDir:
import * as DigitalOcean from "@alchemy.run/digitalocean";import * as Alchemy from "alchemy";import * as Effect from "effect/Effect";
export default Alchemy.Stack( "MySite", { providers: DigitalOcean.providers(), state: Alchemy.localState() }, Effect.gen(function* () { const site = yield* DigitalOcean.Website.Astro("Web", { rootDir: "./web" }); return { url: site.url }; }),);The resources are Astro, Nextjs, Nuxt, SvelteKit, SolidStart, ReactRouter, TanStackStart, Waku, Vinext, Vite, Vocs, Foldkit and Octane. Deploy needs Docker, and the team’s Container Registry or a registry you declare.
Pass configuration
Section titled “Pass configuration”env reaches both the server and the framework’s dev server. It takes Outputs, so a site can point at an API in the same Stack:
const api = yield* Api;yield* DigitalOcean.Website.Nuxt("Web", { rootDir: "./web", env: { API_URL: api.url },});Size it
Section titled “Size it”region, instanceSizeSlug and instanceCount work as on any App:
DigitalOcean.Website.Nextjs("Web", { rootDir: "./web", region: "ams", instanceSizeSlug: "apps-s-1vcpu-1gb", instanceCount: 2,});Serve a static site
Section titled “Serve a static site”StaticSite runs any build command and serves its output directory:
yield* DigitalOcean.Website.StaticSite("Blog", { command: "hugo --minify", outdir: "public",});spa: true answers unknown paths with index.html, for single-page apps. It runs as an App with a small file server, because App Platform’s own static sites build only from a git repository.
Develop locally
Section titled “Develop locally”Under alchemy dev, each site runs its framework’s dev server on your machine instead of deploying, with the same env. See Local development.
Limits
Section titled “Limits”- The build runs on the machine that deploys; it needs the project’s dependencies installed.
- Every deploy that changes the build pushes a new image, and App Platform swaps instances with no downtime, which takes a few minutes.