CLI
Command-line tool for deploying and developing Durable Actor applications on the SLC platform.
Overview
SLC CLI enables you to:
- • Deploy your Durable Actor workers to regional nodes
- • Develop applications locally with remote node support
- • Bundle TypeScript/JavaScript workers into optimized bundles
Each deployed application becomes available as an invokable actor service on the regional node.
Commands
slc deploy
Deploys your application to the regional node specified in `slc.config.json`.
Usage:
slc deployWhat it does:
- Reads `slc.config.json` from the current directory
- Bundles your worker using esbuild
- Uploads the bundle to the regional node via `/_control/deploy-app`
- Makes your app available at
/invoke/<app-name>/:actorId
Output:
Bundling worker...
Uploading to https://api.slc.run...
✓ Deployed app 'my-app'
Invoke via: POST https://api.slc.run/v1/invoke/my-project/my-app/:actorIdslc dev
Starts development mode (currently informational).
Usage:
slc devNote: Local development server coming soon. For now, deploy and test directly against the remote node.
slc config
Manage CLI configuration stored in `~/.slcrc`.
View all config:
slc config getSet a config value:
slc config set endpoint https://api.slc.run
slc config set apiVersion v1
slc config set projectId my-projectGet a specific config value:
slc config get apiVersionslc login
Store your credentials for authentication.
slc loginFollow prompts to enter API key and endpoint. Or set manually:
slc config set apiKey sk_your_api_key
slc config set projectId my-projectConfiguration File
Create `slc.config.json` in your project root:
{
"name": "my-app",
"entry": "./worker.ts"
}Fields:
name(required): Your app name. Used in the invocation URL:/v1/invoke/<projectId>/<name>/:actorIdentry(required): Path to your worker file (relative to config file location)apiBaseUrl(optional): Base URL of the SLC API. If not specified, uses the endpoint from `~/.slcrc` (defaults to `https://api.slc.run`)
Worker Handler
Your worker file must export a default async function with this signature:
export default async function handler(ctx: {
actorId: string;
state: {
get(): Promise<any>;
set(partial: any): Promise<void>;
};
request: Request | { method: string; body?: any };
}): Promise<Response | any>Context Properties:
actorId: Unique identifier for the actor instance (from URL: `/invoke/:app/:actorId`)state: Persistent state managementget(): Retrieves the current state for this actorset(partial): Updates the state (merges with existing state)
request: Request object with `method` and optionally `body`
How It Works
Deployment Flow
- Bundle: Your TypeScript/JavaScript worker is bundled using esbuild
- Format: ESM (ES modules)
- Platform: Node.js
- Target: Node 20+
- All dependencies are bundled (no external deps)
- Upload: The bundle is sent to the regional node via HTTP POST to `/v1/_control/deploy-app` (versioned) or `/_control/deploy-app` (legacy)
- Registration: The node stores the bundle and makes it available at
/v1/invoke/<projectId>/<app-name>/:actorId(versioned) or/invoke/<app-name>/:actorId(legacy)
Invocation Flow
When you invoke an actor:
- Request:
POST /v1/invoke/<projectId>/<app-name>/:actorId(versioned) orPOST /invoke/<app-name>/:actorId(legacy) - Node looks up the app bundle
- Node uses DOSupervisor to get/create actor by `actorId`
- Node provides handler with: `actorId`, `state` wrapper (get/set), `request` (method/body)
- Handler executes and returns response
- Node returns handler's response as HTTP response
Troubleshooting
"slc.config.json not found"
- • Make sure you're running `slc deploy` from the directory containing `slc.config.json`
- • Check that the file is named exactly `slc.config.json`
"Entry file not found"
- • Verify the `entry` path in `slc.config.json` is correct
- • Path is relative to the `slc.config.json` file location
"Failed to connect to <url>"
- • Ensure the regional node is running
- • Check that `apiBaseUrl` in `slc.config.json` is correct
- • Verify network connectivity to the node