Skip to content

Quickstart

This guide covers installation, your first Sprite, and everything you need to build with persistent execution environments.

Install with our install script (macOS/Linux):

Terminal window
curl -fsSL https://sprites.dev/install.sh | sh

This auto-detects your platform, downloads the binary with checksum verification, and installs to ~/.local/bin.

For Windows or manual installation, see CLI Installation or download from GitHub Releases.

Verify installation:

Terminal window
sprite --help

Sprites uses your Fly.io account for authentication:

Terminal window
sprite org auth

This opens a browser window to authenticate with Fly.io.

Terminal window
sprite create my-first-sprite

This creates a new Sprite with default configuration, running and ready to accept commands.

Set it as your active Sprite to avoid adding -s my-first-sprite to every command:

Terminal window
sprite use my-first-sprite

Execute commands in your Sprite:

Terminal window
# Run a simple command
sprite exec echo "Hello, Sprites!"
# Run multiple commands
sprite exec "cd /tmp && ls -la"
# Open an interactive shell
sprite console

Sprites come pre-configured with common development tools:

Terminal window
# Check available runtimes
sprite exec "node --version && python3 --version && go version"
# Install packages
sprite exec "pip install requests"
# Clone a repository
sprite exec "git clone https://github.com/your/repo.git"

Your Sprite’s filesystem persists between commands:

Terminal window
# Create a file
sprite exec "echo 'Hello' > /home/sprite/greeting.txt"
# Later, it's still there
sprite exec "cat /home/sprite/greeting.txt"

Every Sprite has a unique HTTP URL:

Terminal window
sprite url
Terminal window
# List all sprites
sprite list
# Destroy when done
sprite destroy my-first-sprite

Beyond the CLI, you can create and manage Sprites programmatically:

import { SpritesClient } from '@fly/sprites';
const client = new SpritesClient(process.env.SPRITE_TOKEN);
const sprite = await client.createSprite('my-sprite');
// Execute a command
const result = await sprite.execFile('python', ['-c', "print('hello')"]);
console.log(result.stdout);
// Stream output from long-running commands
const cmd = sprite.spawn('bash', ['-c', 'for i in {1..10}; do date +%T; sleep 0.5; done']);
for await (const line of cmd.stdout) {
process.stdout.write(line);
}
await sprite.delete();

Sprites automatically hibernate when inactive, with no compute charges while idle. When you execute a command or make a request to a Sprite’s URL, it automatically wakes up with all your data intact.

Sprites currently hibernate after 30 seconds of inactivity. This timeout is not configurable yet.

A Sprite is considered active if any of the following are true:

  1. It has an active command running (via exec)
  2. Its stdin is being written to
  3. It has an open TCP connection over its URL
  4. A detachable session is running

Sprites currently use a fixed resource configuration (8 vCPUs, 8192 MB RAM, 100 GB storage). These values are not configurable yet. (SDK config fields are accepted but ignored by the API.)

Set the working directory for command execution:

Terminal window
sprite exec -dir /home/sprite/project npm test
Terminal window
sprite exec -env MY_SECRET=hello bash -c 'echo $MY_SECRET'

The default Sprite environment includes:

  • Languages: Node.js, Python, Go, Ruby, Rust, Elixir/Erlang, Java, Bun, Deno
  • AI Tools: Claude CLI, Gemini CLI, OpenAI Codex, Cursor
  • Utilities: Git, curl, wget, vim, and common development tools

Run setup commands after creating a Sprite:

const sprite = await client.createSprite('my-sprite');
// Install custom dependencies
await sprite.exec('pip install pandas numpy matplotlib');
await sprite.exec('npm install -g typescript');
// Clone a repository
await sprite.exec('git clone https://github.com/your/repo.git /home/sprite/project');

For interactive applications, enable TTY mode:

Terminal window
# Open interactive shell (TTY enabled by default)
sprite console
# Or with exec
sprite exec -tty bash

Create sessions that persist even after disconnecting:

Terminal window
# Create a detachable session
sprite exec -detachable "npm run dev"
# List active sessions
sprite exec
# Attach to a session
sprite exec -id <session-id>
Terminal window
sprite exec

Terminal window
# Set active sprite for current directory
sprite use my-sprite
# Commands now use this sprite
sprite exec echo "hello"
Terminal window
# List all sprites
sprite list
# List with prefix filter
sprite list --prefix "dev-"

Every Sprite has a unique URL for HTTP access:

Terminal window
# Get sprite URL
sprite url
# Make URL public (no auth required)
sprite url update --auth public
# Make URL require sprite auth (default)
sprite url update --auth default

Updating URL settings is available via the CLI, Go SDK, or REST API (the JS SDK does not expose a helper yet).


Forward local ports to your Sprite:

Terminal window
# Forward local port 3000 to sprite port 3000
sprite proxy 3000
# Forward multiple ports
sprite proxy 3000 8080 5432

Get notified when ports open in your Sprite:

const cmd = sprite.spawn('npm', ['run', 'dev']);
cmd.on('message', (msg) => {
if (msg.type === 'port_opened') {
console.log(`Port ${msg.port} opened on ${msg.address} by PID ${msg.pid}`);
// Auto-forward or notify user
}
});

Save and restore Sprite state:

Terminal window
# Create a checkpoint
sprite checkpoint create
# List checkpoints
sprite checkpoint list
# Restore from checkpoint
sprite restore <checkpoint-id>

See Checkpoints and Restore for more details.


import { ExecError } from '@fly/sprites';
try {
await sprite.execFile('bash', ['-lc', 'exit 1']);
} catch (error) {
if (error instanceof ExecError) {
console.log('Exit code:', error.exitCode);
console.log('Stdout:', error.stdout);
console.log('Stderr:', error.stderr);
}
}

Always clean up Sprites when you’re done:

Terminal window
sprite destroy my-sprite

Add this helper function to your .zshrc or .bashrc to mount your Sprite’s home directory locally:

Terminal window
# Add to ~/.zshrc
sc() {
local sprite_name="${1:-$(sprite use)}"
local mount_point="/tmp/sprite-${sprite_name}"
mkdir -p "$mount_point"
sshfs -o reconnect,ServerAliveInterval=15,ServerAliveCountMax=3 \
"sprite@${sprite_name}.sprites.dev:" "$mount_point"
cd "$mount_point"
}

Then use it with:

Terminal window
sc my-sprite # Mounts and cd's to the sprite's filesystem