Skip to content

squarecloudofc/sdk-api-js

Repository files navigation

Square Cloud Banner

@squarecloud/api

A NodeJS SDK for consuming the Square Cloud API.

Installation

npm install @squarecloud/api
# or
yarn add @squarecloud/api
# or
pnpm add @squarecloud/api

Documentation

Visit the official documentation for the full API reference.

Quick start

import { SquareCloudAPI } from "@squarecloud/api";

const api = new SquareCloudAPI(process.env.SQUARE_API_KEY!);

// Fetch your account (user + applications + databases)
const user = await api.user.get();

console.log(`Hi ${user.name}! You have ${user.applications.size} apps.`);

// Grab one application by ID and control it
const app = await api.applications.fetch("abc123def456abc123def456");

await app.start();
await app.envs.set({ DATABASE_URL: "postgres://..." });
const logs = await app.getLogs();

Features

The client exposes the full v2 platform surface:

  • api.user — your account, plan, snapshots
  • api.applications — list, create (upload), fetch
  • Application — status, logs, metrics, start/stop/restart, commit, realtime SSE
    • .files — read, write, list, move, delete
    • .envs — environment variables (list/set/replace/delete)
    • .snapshots — list, create, download, restore
    • .deploys — list, GitHub App link, webhook, current config
    • .network (websites only) — custom domain, DNS, analytics, errors, logs, performance, purge cache
  • api.databases — create, list, fetch
  • Database — status, metrics, start/stop, update, delete
    • .credentials — TLS certificate, rotate password/certificate
    • .snapshots — list, create, download, restore
  • api.workspaces — list, create, fetch
  • Workspace — leave, delete
    • .members — add, update role, remove
    • .applications — share, unshare
  • api.service — platform health

Examples

Runnable snippets per area live in examples/:

Contributing

Bug reports and PRs welcome at squarecloudofc/sdk-api-js.

Authors

About

A wrapper written in JavaScript with a focus on using our API.

Topics

Resources

License

Stars

Watchers

Forks

Packages

 
 
 

Contributors