Development Environments
This guide shows how to use Firecase to create instant, reproducible development environments. Spin up a pre-configured workspace, share it with your team, and tear it down when you're done.
Why Firecase for Dev Environments?
Traditional dev environment approaches have trade-offs:
| Approach | Startup | Isolation | Reproducibility | Cost |
|---|---|---|---|---|
| Local machine | Instant | None | Poor | Free |
| Docker | Seconds | Process-level | Good | Free |
| Cloud VMs (EC2, etc.) | Minutes | Full | Medium | $$$ |
| Firecase | ~150ms | Hardware-level | Excellent | Pay per use |
Firecase gives you full VM isolation with container-like speed, plus persistent state and instant forking.
Basic Setup
1. Create an Instance from a Base Image
Start with a pre-built base image that has your language runtime and tools:
curl -X POST https://api.firecase.ai/instances \
-H "Authorization: Bearer $API_KEY" \
-H "Content-Type: application/json" \
-d '{
"name": "dev-workspace",
"base_image_id": "550e8400-e29b-41d4-a716-446655440000",
"vcpus": 4,
"memory_mib": 4096
}'2. Start the VM
curl -X POST https://api.firecase.ai/instances/{id}/vm \
-H "Authorization: Bearer $API_KEY"3. Install Your Project Dependencies
# Clone your repo
curl -X POST https://api.firecase.ai/instances/{id}/exec \
-H "Authorization: Bearer $API_KEY" \
-d '{
"command": ["git", "clone", "https://github.com/your-org/your-repo.git", "/home/user/project"],
"timeout_ms": 60000
}'
# Install dependencies
curl -X POST https://api.firecase.ai/instances/{id}/exec \
-H "Authorization: Bearer $API_KEY" \
-d '{
"command": ["bash", "-c", "cd /home/user/project && npm install"],
"timeout_ms": 120000
}'4. Checkpoint the Environment
Save this state so you can instantly restore or share it:
curl -X POST https://api.firecase.ai/instances/{id}/checkpoints \
-H "Authorization: Bearer $API_KEY" \
-d '{"label": "deps-installed"}'5. Start Your Dev Server and Forward the Port
# Start the dev server in the background
curl -X POST https://api.firecase.ai/instances/{id}/exec \
-H "Authorization: Bearer $API_KEY" \
-d '{
"command": ["bash", "-c", "cd /home/user/project && nohup npm run dev > /tmp/dev.log 2>&1 &"],
"timeout_ms": 5000
}'
# Forward port 3000
curl -X POST https://api.firecase.ai/instances/{id}/port-forwards \
-H "Authorization: Bearer $API_KEY" \
-d '{"guest_port": 3000, "label": "dev-server"}'The response gives you a public URL to access your dev server.
SSH Access
For interactive development, configure SSH and use your local editor's remote extension (VS Code Remote SSH, JetBrains Gateway, etc.):
# Set your SSH key
curl -X PUT https://api.firecase.ai/instances/{id}/ssh-keys \
-H "Authorization: Bearer $API_KEY" \
-d '{"keys": ["ssh-ed25519 AAAAC3... user@laptop"]}'
# Get connection info
curl https://api.firecase.ai/instances/{id}/ssh \
-H "Authorization: Bearer $API_KEY"Then connect:
ssh root@compute-1.firecase.aiEnvironment Templates
Create a reusable template by setting up an environment once, checkpointing it, and forking for each developer:
# One-time setup: create the template
template = client.instances.create(name="template-nodejs-20")
client.vms.start(template.id)
# Install everything
client.exec(template.id, command=["bash", "-c", """
curl -fsSL https://deb.nodesource.com/setup_20.x | bash -
apt-get install -y nodejs
npm install -g typescript tsx prettier eslint
"""])
# Checkpoint
checkpoint = client.checkpoints.create(template.id, label="nodejs-20-ready")
client.vms.stop(template.id)
# For each developer, fork from the template
def create_dev_env(developer_name: str):
env = client.instances.fork(
template.id,
name=f"dev-{developer_name}",
checkpoint_id=checkpoint.id
)
client.vms.start(env.id)
return envEach fork is instant and shares the base chunks. Developers only pay for storage of their changes.
Multi-Service Development
For microservice projects, spin up multiple sandboxes and connect them:
# Backend API
api = client.instances.create(name="dev-api", vcpus=2, memory_mib=2048)
client.vms.start(api.id)
client.exec(api.id, command=["bash", "-c", "cd /app && npm start &"])
api_forward = client.port_forwards.create(api.id, guest_port=8080, label="api")
# Frontend
frontend = client.instances.create(name="dev-frontend", vcpus=2, memory_mib=2048)
client.vms.start(frontend.id)
# Point frontend at the API
client.exec(frontend.id, command=["bash", "-c",
f"echo 'API_URL=http://{api_forward.hostname}:{api_forward.host_port}' > /app/.env"
])
client.exec(frontend.id, command=["bash", "-c", "cd /app && npm run dev &"])
frontend_forward = client.port_forwards.create(frontend.id, guest_port=3000, label="frontend")
print(f"Frontend: http://{frontend_forward.hostname}:{frontend_forward.host_port}")
print(f"API: http://{api_forward.hostname}:{api_forward.host_port}")Cleanup
Stop and optionally delete environments when done:
# Stop (preserves state for later)
curl -X DELETE https://api.firecase.ai/instances/{id}/vm \
-H "Authorization: Bearer $API_KEY"
# Delete (permanent)
curl -X DELETE https://api.firecase.ai/instances/{id} \
-H "Authorization: Bearer $API_KEY"Use auto_delete_on_stop: true in your profile to automatically clean up instances when the VM stops.
Next Steps
- Learn about Custom Base Images to build your own templates
- See Port Forwarding for exposing services
- Explore SSH access for remote editor integration