Quick Start (Server)
Initialize the server SDK with a secret key.
import Buildspace from "@buildspacestudio/sdk";
const bs = new Buildspace(process.env.BUILDSPACE_SECRET_KEY!);The server SDK uses the same hosted defaults as the client (https://api.buildspace.studio and https://login.buildspace.studio). Pass baseUrl and/or loginUrl only when you target another environment (local development or self-hosted):
new Buildspace(secretKey, {
baseUrl: "https://your-runtime.example",
loginUrl: "https://your-login.example",
});Example calls:
const session = await bs.auth.getSession(sessionToken);
await bs.events.track("user:signed-in", { email: session?.user.email });
const signed = await bs.storage.getSignedUrl("uploads/report.pdf");
await bs.notifications.send({ to: "user@example.com", subject: "Hi", html: "<p>Hello</p>" });