Skip to content
betterstack-alchemyUnofficial

betterstack-alchemy

Better Stack is an observability platform with its own cloud. It checks your sites and APIs from several regions, opens incidents, pages whoever is on call, and publishes status pages. It stores logs and metrics with dashboards and alerts, and it tracks exceptions sent by the Sentry SDKs.

Better Stack Cloud runs what it watches: servers, Services, volumes, private networks, firewalls, load balancers and managed databases, in availability zones you choose.

New to Better Stack? Start with What is Better Stack?.

A server is a declaration:

src/server.ts
import * as BetterStack from "betterstack-alchemy";
export const Box = BetterStack.Cloud.Server("Box", { serverType: "AM1", image: "ubuntu-26-04" });

A Service is your program on it:

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

And the Stack deploys both, with an uptime monitor on the Service:

alchemy.run.ts
import * as Alchemy from "alchemy";
import * as Output from "alchemy/Output";
import * as BetterStack from "betterstack-alchemy";
import * as Effect from "effect/Effect";
import Api from "./src/api.ts";
export default Alchemy.Stack(
"MyApp",
{ providers: BetterStack.providers(), state: Alchemy.localState() },
Effect.gen(function* () {
const api = yield* Api;
const uptime = yield* BetterStack.Incidents.Monitor("ApiUp", {
url: Output.interpolate`${api.url}/health`,
monitorType: "status",
});
return { url: api.url, monitorId: uptime.id };
}),
);

Want to build? The tutorial goes from an empty directory to a server running an HTTP Service with a volume, an uptime monitor, a heartbeat and a status page, one step at a time. Start with Setup to connect your team.

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