RustAPI Cloud
Deploy RustAPI applications to managed hosting with a single CLI workflow. The framework and CLI live in this repository; the cloud backend (OAuth, storage, nginx routing, deploy pipeline) lives in the separate RustAPI-Cloud repository.
Overview
| Component | Repository | Role |
|---|---|---|
rustapi-rs + cargo-rustapi | Tuntii/RustAPI | Framework, CLI, deploy cloud client |
| RustAPI Cloud backend | Tuntii/RustAPI-Cloud | Auth, build pipeline, HTTPS routing, app hosting |
Default cloud API: https://api.rustapi.cloud
Self-hosted operators can run their own cloud backend from RustAPI-Cloud and point the CLI with --cloud-url.
Prerequisites
- Rust 1.85+ and a working
cargotoolchain cargo-rustapiinstalled (cargo install cargo-rustapi)- A RustAPI project with a release binary (the CLI builds
cargo build --releaseautomatically) - Cloud feature enabled (on by default in
cargo-rustapi)
Quick start
# 1. Authenticate (device-code OAuth — opens browser)
cargo rustapi login
# 2. Verify session
cargo rustapi whoami
# 3. Deploy from project root (builds, packages, uploads)
cargo rustapi deploy cloud
# 4. Poll deploy progress (use ID from deploy output)
cargo rustapi deploy status <deploy-id>
After a successful deploy, your app is available at a public HTTPS URL:
https://{project}-{user8}.rustapi.{domain}
{project}— Cargo package name or--nameoverride{user8}— first 8 characters of your GitHub user id{domain}— configured on the cloud backend (managed default:rustapi.cloud)
Authentication
cargo rustapi login
Device-code OAuth flow (RFC 8628):
cargo rustapi login
cargo rustapi login --cloud-url https://api.rustapi.cloud
cargo rustapi login --no-browser # print URL only, no auto-open
What happens:
- CLI requests a device code from
{cloud_url}/auth/device - You open the verification URL and enter the user code
- CLI polls
{cloud_url}/auth/tokenuntil authorized - Access + refresh tokens saved to
~/.rustapi/config.json(orRUSTAPI_CONFIG_PATH)
cargo rustapi whoami
Prints the logged-in GitHub username, tier, and cloud URL from local config.
cargo rustapi logout
Removes local credentials. Does not revoke tokens server-side.
Deploy
cargo rustapi deploy cloud
Builds a release binary, packages it, and uploads to RustAPI Cloud.
cargo rustapi deploy cloud
cargo rustapi deploy cloud --name my-api
cargo rustapi deploy cloud --no-wait # return immediately after upload
Pipeline steps (server-side, in RustAPI-Cloud):
- Receive upload and queue deploy job
- Extract binary and configure runtime
- Route traffic via nginx wildcard vhost
- Expose HTTPS URL
cargo rustapi deploy status <deploy-id>
Poll deploy job state:
cargo rustapi deploy status abc123-def456
Typical states: queued → building → deploying → running / failed.
Use this when --no-wait was passed or when checking a long-running deploy from CI.
Configuration
Local credentials
Default path:
| OS | Path |
|---|---|
| Linux/macOS | ~/.rustapi/config.json |
| Windows | %USERPROFILE%\.rustapi\config.json |
Schema:
{
"token": "<access-token>",
"refresh_token": "<refresh-token>",
"user": {
"login": "your-github-username",
"tier": "hobby",
"avatar_url": "https://..."
},
"last_login": "2026-06-25T12:00:00Z",
"cloud_url": "https://api.rustapi.cloud"
}
RUSTAPI_CONFIG_PATH
Override config file location — useful for CI, multiple profiles, or isolated tests:
export RUSTAPI_CONFIG_PATH=/tmp/rustapi-ci-config.json
cargo rustapi deploy cloud
The CLI creates parent directories when saving config.
Cloud feature flag
Cloud HTTP commands are gated behind the cloud feature on cargo-rustapi (enabled by default):
# Cargo.toml — disable cloud commands
[dependencies]
cargo-rustapi = { version = "0.1.550", default-features = false }
When disabled, login, deploy cloud, and deploy status are not compiled. Workspace builds with --no-default-features remain supported.
Self-hosted cloud backend
To run your own RustAPI Cloud instance:
- Clone Tuntii/RustAPI-Cloud
- Follow its
install.sh/ docker-compose setup - Point CLI at your API:
cargo rustapi login --cloud-url https://cloud.example.com
cargo rustapi deploy cloud
Backend configuration (ports, Postgres, wildcard TLS, nginx templates) is documented in the RustAPI-Cloud repository.
Production recommendations
Before deploying to cloud:
- Enable
.production_defaults("your-service")— see Production Baseline - Set
RUSTAPI_ENV=production - Run
cargo rustapi doctor --strict - Complete the Production Checklist
For self-managed infra (Docker, K8s, Fly.io), see Deployment instead.
Troubleshooting
| Problem | Fix |
|---|---|
Not logged in | Run cargo rustapi login |
| Device code expired | Re-run cargo rustapi login |
| Deploy times out | Check cargo rustapi deploy status <id>; verify cloud backend health |
| Wrong cloud instance | logout, then login --cloud-url <correct-url> |
| CI needs isolated creds | Set RUSTAPI_CONFIG_PATH to a temp file with test tokens |
cloud commands missing | Reinstall with default features: cargo install cargo-rustapi |
Architecture (high level)
Developer machine RustAPI Cloud backend
┌─────────────────────┐ ┌──────────────────────────┐
│ cargo rustapi login │──OAuth─────▶│ /auth/device, /auth/token│
│ cargo rustapi │ │ │
│ deploy cloud │──upload────▶│ /deploy │
│ cargo rustapi │ │ → build queue │
│ deploy status │◀──poll──────│ → nginx wildcard route │
└─────────────────────┘ │ → HTTPS public URL │
└──────────────────────────┘