Cloud Templates
DeprecatedDeprecated cloud-hosted templates that mirror your local dev setup.
Cloud Templates have been superseded by Droid Computers.
Cloud Templates are still supported, but we highly recommend switching for stability.
Cloud templates let you code anywhere without the "works on my machine" dance. Each template is a pre-configured environment that lives in the cloud, boots in seconds and can be customized to run setup commands.
Why use cloud templates?
| Benefit | What it means for you |
|---|---|
| Zero setup | Open a session and start coding; no local installs or VM juggling. |
| Consistency | Every teammate (and CI job) runs the exact same environment. |
| Speed | Heavy builds run on powerful cloud CPUs; your laptop fan stays silent. |
| Isolation | Experiments live in disposable templates, keeping your local machine clean. |
| Collaboration | Share a template link; reviewers jump into the live environment with code and ports already running. |
Installation & usage
A cloud template is a fully-configured, on-demand development environment that lives in the cloud. Cloud templates give you the same tools and dependencies you'd expect locally, so you can build, test, and run code directly from Factory.
To get the most out of cloud templates, configure environment variables and a setup script during template creation. The setup script installs dependencies and prepares your development environment automatically, so every team member gets an identical setup.
System requirements
- A repository enabled in Factory
- User role or higher to create cloud templates
- 1Open Cloud Templates Settings
- 1In Factory, click the Settings icon from the left sidebar.
- 2Select Cloud Templates.
- 1
- 2Create a New Cloud Template
- 1Click Create Template.
- 2Enter the repository you want to use.
- 3Give your template a friendly name (e.g., "frontend-template").
- 4(Optional) Configure a setup script to run during template initialization.
- 5Click Create.
NoteFactory clones your repo and prepares the environment. This can take a minute for large projects.
- 1
- 3Verify Template Ready
The new template appears in the list with a status indicator. Once it shows Ready, you can use it from any session.
Launching a cloud template inside a session
- 1Open or Start a Session
Join any Factory session as usual.
- 2Connect to Cloud Machine
- 1On the session start page, click the Machine Connection button.
- 2Choose Remote tab.
- 3Select the template you created earlier.
- 4Factory attaches the cloud template to your session.
Cloud template attachment flow in the Factory session setup UI - 1
- 3Confirm Connection
A green indicator and remote working directory appear on the top-right next to your profile dropdown menu. You're now interacting with the cloud template.
Everyday usage
Use the Terminal toolkit to execute commands like:
npm run dev pytest git status
Output streams live into chat and logs.
Open files from the repo, make changes, and save. Files persist in the cloud template and can be committed upstream when ready.
Auto-save is disabled by default. Enable it from the Session Settings panel whenever you want live file syncing.
Setup script
The setup script is a shell script that Factory runs during template creation, after your repository is cloned and before the template is activated. Use this feature to set up your template and give droid tools to work with your codebase.
How to define a setup script
- 1In the modal for template creation, in the "Setup Script (Optional)" section, add your initialization script. You can write a multi-line bash script with all the commands you need.
- 2Submit. The script runs in the repo root exactly as provided. Add
set -euo pipefailat the top of your script if you want strict error handling. Script failures will stop the build. - 3Keep your script non‑interactive and idempotent. Write commands that can be safely re-run.
- 4Review build logs if anything fails to see detailed output from your script execution.
Examples:
Node.js (Next.js):
#!/usr/bin/env bash
set -euo pipefail
npm ci
npm run buildPNPM monorepo:
#!/usr/bin/env bash
set -euo pipefail
pnpm -w i
pnpm -w buildPython:
#!/usr/bin/env bash
set -euo pipefail
pip install -r requirements.txt
pytest -qMulti-language project:
#!/usr/bin/env bash
set -euo pipefail
# Install Node.js dependencies
npm ci
# Install Python dependencies
pip install -r requirements.txt
# Run setup script
bash ./scripts/setup.shWhat happens under the hood:
- The script executes after repository cloning, inside the build container at the repo root.
- Environment variables specified in template settings are available during script execution.
- Errors are surfaced clearly (e.g.,
Setup script failed: ...) for quick fixes.
Setup script troubleshooting tips
Best practices
Cloud templates let you spin up consistent, production-ready development environments in seconds. Below are field-tested practices that keep templates fast, predictable, and team-friendly.
Smart setup script practices
| Practice | Why it matters | How to do it |
|---|---|---|
| Order commands by dependency | Later commands may depend on earlier installs. | Run package installation first: npm ci && npm run build or pip install -r requirements.txt && pytest -q |
| Use exact package managers | Consistent lockfiles prevent version drift. | Use npm ci (not npm install), pnpm -w i, or pip install -r requirements.txt for reproducible builds |
| Add error handling | Stops build on first failure, saves debugging time. | Start your script with #!/usr/bin/env bash and set -euo pipefail for proper error handling |
| Make scripts executable early | Avoid permission errors mid-build. | Add chmod +x ./scripts/setup.sh && bash ./scripts/setup.sh or use bash ./scripts/setup.sh directly |
| Keep scripts idempotent | Re-running setup shouldn't break things. | Use flags like pip install --no-deps or check for existing files before creating them |
| Minimize heavy operations | Long builds slow down template creation. | Focus on essential setup; defer optional tools to manual installation later |
Tip: Test your setup script locally first. The script runs with
bashat the repo root, and you can addset -euo pipefailfor strict error handling.
Workflow patterns that scale
| Pattern | How to use it | Benefit |
|---|---|---|
| Spin-Up-Per-Task | Treat remote sessions as disposable: create one per ticket or PR, then archive when merged. | Perfect isolation, zero "works on my machine" drift. |
| Parallel Environments | Launch two separate sessions when you need to test multiple branches. | Switch context without killing processes. |
Team collaboration tips
| Tip | Details |
|---|---|
| Name templates clearly | Name templates according to the tracked repository, e.g. repo-name to work on a repository named repo-name. |
| Document entry commands | Add an AGENTS.md file with common tasks (npm run dev, pytest). Droid automatically reads this file. |
Troubleshooting
Even the smoothest cloud template can hit a snag. This section walks you through the quickest fixes for the most common cloud template issues.