Skip to content

Hetzner

Hetzner rents dedicated and cloud servers at a fraction of the large clouds’ prices. Hetzner Cloud, its virtual-machine platform, runs in Germany, Finland, the US and Singapore.

Around its Servers, Hetzner Cloud offers just what servers need: network disks, private networks, firewalls, load balancers, IP addresses and DNS. There are no managed functions or queues: you run your own programs on your own machines.

New to Hetzner? Start with What is Hetzner?.

A Server is a declaration:

src/server.ts
import * as Hetzner from "@alchemy.run/hetzner";
export const Box = Hetzner.Server("Box", { serverType: "cx22", image: "ubuntu-24.04", location: "nbg1" });

A Service is your program on it:

src/api.ts
import * as Hetzner from "@alchemy.run/hetzner";
import * as Effect from "effect/Effect";
import * as HttpServerResponse from "effect/http/HttpServerResponse";
import { Box } from "./server.ts";
export default class Api extends Hetzner.Service<Api>()(
"Api",
{ server: Box, main: import.meta.url, port: 3000 },
Effect.gen(function* () {
return {
fetch: Effect.succeed(HttpServerResponse.text("hello from Hetzner")),
};
}),
) {}

And the Stack deploys both to your project:

alchemy.run.ts
import * as Alchemy from "alchemy";
import * as Hetzner from "@alchemy.run/hetzner";
import * as Effect from "effect/Effect";
import Api from "./src/api.ts";
export default Alchemy.Stack(
"MyApp",
{ providers: Hetzner.providers(), state: Alchemy.localState() },
Effect.gen(function* () {
const api = yield* Api;
return { url: api.url };
}),
);

Want to build? The tutorial goes from an empty directory to a Server running an HTTP Service with a Volume and a firewall, one step at a time. Start with Setup to connect your project.

Looking for something specific? Every section of these docs is listed below, and every resource is in the generated API reference.