@enzonic/cloud-api
v1.0.1
Published
Official client for the Enzonic Cloud API hosting API — deploy and manage game/app servers programmatically.
Maintainers
Readme
@enzonic/cloud-api
Official client for the Enzonic Cloud API — deploy and manage game/app servers programmatically.
npm install @enzonic/cloud-apiimport { CloudClient } from "@enzonic/cloud-api";
const cloud = new CloudClient({ apiKey: process.env.CLOUD_API_KEY! });
// deploy
const server = await cloud.servers.create({
name: "lobby-smp",
eggId: 3,
region: "USA", // or null for auto-placement
ramMb: 2048,
cpuPercent: 200,
diskMb: 10240,
});
// control
await cloud.servers.power(server.id, "start");
await cloud.servers.command(server.id, "say hello");
const usage = await cloud.servers.resources(server.id);
// files
await cloud.files.write(server.id, "/server.properties", "pvp=true\n");
// account
const me = await cloud.account(); // { balanceUsd, ... }Auth
Pass a Clerk API key secret as apiKey. Create one in your Cloud API dashboard
(API keys). The same client also accepts a Clerk session token.
Surface
cloud.account(), cloud.transactions(), cloud.regions(), cloud.instances(),
cloud.eggs(), cloud.egg(), cloud.keys.*, cloud.servers.*, cloud.files.*,
cloud.admin.*.
Errors throw CloudError with status, code and message.
Options
new CloudClient({
apiKey: "ak_live_...",
baseUrl: "https://api.cloud.enzonic.com", // optional
fetch: customFetch, // optional (Node <18 / testing)
});Full docs: https://cloud.api.panel.enzonic.com/docs
