Part 1: Your First App
An App on App Platform is your program, built into an image and served over HTTPS. You’ll write one, deploy it, and call it.
Prerequisites
Section titled “Prerequisites”- Node.js 24.11.1+ or Bun
- Docker, to build the App’s image
- A DigitalOcean token stored in a profile. See Setup.
Create a project
Section titled “Create a project”mkdir my-app && cd my-app && pnpm initmkdir my-app && cd my-app && bun init -ymkdir my-app && cd my-app && npm init -ymkdir my-app && cd my-app && yarn init -ypnpm add https://pkg.alchemy.run/alchemy/pr:3743:41147c9 https://pkg.alchemy.run/@alchemy.run/digitalocean/pr:3743:41147c9 effect @effect/platform-nodebun add https://pkg.alchemy.run/alchemy/pr:3743:41147c9 https://pkg.alchemy.run/@alchemy.run/digitalocean/pr:3743:41147c9 effect @effect/platform-nodenpm install https://pkg.alchemy.run/alchemy/pr:3743:41147c9 https://pkg.alchemy.run/@alchemy.run/digitalocean/pr:3743:41147c9 effect @effect/platform-nodeyarn add https://pkg.alchemy.run/alchemy/pr:3743:41147c9 https://pkg.alchemy.run/@alchemy.run/digitalocean/pr:3743:41147c9 effect @effect/platform-nodeCreate the Stack
Section titled “Create the Stack”A Stack is everything you deploy together. Create alchemy.run.ts:
import * as DigitalOcean from "@alchemy.run/digitalocean";import * as Alchemy from "alchemy";import * as Effect from "effect/Effect";
export default Alchemy.Stack( "MyApp", { providers: DigitalOcean.providers(), state: Alchemy.localState() }, Effect.gen(function* () {}),);DigitalOcean.providers() deploys with your profile’s token, into its team. Alchemy.localState() keeps Alchemy’s record of what it created in .alchemy/, next to your code.
Declare a Container Registry
Section titled “Declare a Container Registry”App Platform runs images from your team’s Container Registry, and a team has one. Declare it:
import * as DigitalOcean from "@alchemy.run/digitalocean";
export const Registry = DigitalOcean.Registry("Registry", { tier: "starter" });The starter tier is free and holds one repository. If your team already has a registry, skip this step: an App uses the team’s registry when you don’t name one.
Write the App
Section titled “Write the App”An App is a class: its props say where it runs, and its Effect returns the handlers it serves.
import * as DigitalOcean from "@alchemy.run/digitalocean";import * as Effect from "effect/Effect";import * as HttpServerResponse from "effect/http/HttpServerResponse";import { Registry } from "./resources.ts";
export default class Api extends DigitalOcean.App<Api>()( "Api", { main: import.meta.url, region: "nyc", registry: Registry }, Effect.gen(function* () { return { fetch: Effect.succeed(HttpServerResponse.text("hello from App Platform")), }; }),) {}main: import.meta.url tells Alchemy which file to bundle into the image.
Add the App to the Stack
Section titled “Add the App to the Stack”import * as DigitalOcean from "@alchemy.run/digitalocean";import * as Alchemy from "alchemy";import * as Effect from "effect/Effect";import Api from "./src/api.ts";
export default Alchemy.Stack( "MyApp", { providers: DigitalOcean.providers(), state: Alchemy.localState() }, Effect.gen(function* () {}), Effect.gen(function* () { const api = yield* Api; return { url: api.url }; }),);The Stack’s return value is printed after each deploy.
Deploy
Section titled “Deploy”pnpm alchemy deploybun alchemy deploynpx alchemy deployyarn alchemy deployAlchemy creates the registry, builds and pushes the image, then waits until App Platform serves it. The first deploy takes a few minutes. It prints the App’s address:
url: https://api-xxxxx.ondigitalocean.appCall it
Section titled “Call it”curl https://api-xxxxx.ondigitalocean.app# hello from App PlatformChange it
Section titled “Change it”Edit the response text and deploy again. Alchemy builds a new image only when your code changed, and App Platform switches to it with no downtime.
Next, in Part 2, the App stores files in a Spaces bucket.