Skip to content

Railway.Workspace reference

Source: src/Railway/AuditLog.ts

List workspace audit logs. Query-only — Railway has no audit-log create/update/delete, so this is a catalog helper, not a resource.

Defaults to the current token workspace. Pass project / environment to filter. The result may be empty.

Workspace logs

const logs = yield* Railway.listAuditLogs();

Filter by project

const site = yield* Railway.Project("Site");
const logs = yield* Railway.listAuditLogs({
project: site,
environment: site,
});
const log = yield* Railway.getAuditLog({ id: logs[0].id });
const types = yield* Railway.listAuditLogEventTypes();

Source: src/Railway/Usage.ts

A Railway.UsageLimit is a soft/hard dollar cap on a workspace customer. One limit per customer. usageLimitRemove is idempotent.

usage is a catalog helper — not a resource. It returns aggregated rows for the current workspace (or a project).

const rows = yield* Railway.usage({
measurements: ["CPU_USAGE", "MEMORY_USAGE_GB"],
});

Omit workspace / project to cap the current token workspace. A number is the soft dollar cap.

Soft cap

const cap = yield* Railway.UsageLimit("SpendCap", {
limit: 50,
});

Soft and hard

const cap = yield* Railway.UsageLimit("SpendCap", {
project: site,
limit: { softLimitDollars: 50, hardLimitDollars: 100 },
});

Resource-valued props accept the resource or an Effect producing it.

src/billing.ts
import * as Railway from "alchemy/Railway";
export const Site = Railway.Project("Site");
export const SpendCap = Railway.UsageLimit("SpendCap", {
project: Site,
limit: 50,
});