ASTRODOCK Docs astrodock.ai GitHub ↗

Building Apps

Let an AI Build & Deploy

This is the headline use case. Stand Astrodock up once, then point a coding agent (like Claude Code) at it and let the agent build a small app and launch it on the open internet, end to end. You hand over a token and a contract; the agent does the loop.

The Fastest Way: Give Your AI One Prompt

Paste this into Claude Code, Codex, Cursor or another agent that can run commands, and add what you want built:

Read https://astrodock.ai/llms.txt, then use Astrodock to build this and share it with me:

The agent sends you a link with your email address filled in. Press Send Code and enter the 6-digit code from your email. That verifies your email and creates a free account. The agent then builds an artifact, shares it with the people you name, and sends you its address. For a full app on a server, the agent uses the steps below.

Before You Start

On Astrodock Cloud, you need nothing yet: the agent's first command signs you up. Self-hosted, you should have Astrodock installed and running. If you've never deployed an app here by hand, do Deploy your first app first. The agent runs the exact same loop, so it helps to have seen it once.

The Quick Way: astrodock login

The agent can get its own key. In the app's folder it runs:

# Astrodock Cloud: signs you up first if you're new
npx @astrodock/cli login

# Self-hosted: your dashboard's address
npx @astrodock/cli login --url https://admin.your-domain

The command opens a page in your browser, or prints the link if it can't. On Astrodock Cloud, that page is where you sign up, choose a plan and pay. See Astrodock Cloud. Then you approve the key with your passkey or an authenticator code. Approve only if the check code on the page matches the one the terminal printed.

The CLI saves the key in .env.astrodock and adds that file to .gitignore. You choose what the key covers:

KeyWhat It Can Do
This app (the default)Build, deploy and configure the one app in the folder, and manage its users, feedback and work items.
Every appThe same on every app, plus Pages.

Neither can make keys, delete apps, run commands on the server, change platform settings or run backups. Some actions reach past one app, so they wait for you: creating another app, adding a custom domain, giving an app to someone who already has an account, and turning on Google sign-up for an app. The CLI prints a link and waits. You approve on that page with your passkey or an authenticator code, every time. A password does not count.

With the key saved, skip to Step 3. Steps 1 and 2 are the manual way: a key you make yourself in the dashboard.

How It Works

Astrodock gives an agent everything it needs to ship without you in the loop for each step:

  • A scoped API token the agent uses to drive the platform (deploy, set secrets, and whatever else its scopes allow). No preset can mint or revoke tokens.
  • A thin, predictable CLI (astrodock) with machine-friendly output.
  • An agent-readable contract in AGENTS.md: the app layout, the env-var model, the deploy lifecycle, and the definition of done.

Give the agent the token and point it at AGENTS.md, and it has a precise, drivable path from empty folder to a live URL.

Step 1: Mint a Token for the Agent

In the dashboard, open Access Keys → New Key and give it a name (e.g. "claude agent"). The value is shown once. Copy it. You can optionally scope the token to specific app slugs so the agent can only touch those apps.

Scope It Down for One Task

If you want the agent to work on just one app, restrict the token to that app's slug. A fresh, unscoped token is fine for "build me something new" since the agent picks the slug as it scaffolds.

Step 2: Put the Credentials Where the CLI Finds Them

Create .env.astrodock in the app repo's root (and make sure it's gitignored: the CLI refuses to run if git tracks it):

ASTRODOCK_URL=https://admin.your-domain    # your admin host
ASTRODOCK_TOKEN=tk_paste-the-token-here    # the scoped token

That's the whole handoff. The agent never needs to read the token. It runs astrodock commands in the repo and the CLI picks the credentials up from the file on its own, so the value stays out of the agent's conversation. Locally the URL is http://admin.localhost. (The same two names also work as plain environment variables, which win over the file when both are set.)

Step 3: Point the Agent at the Contract

The build/deploy contract lives in AGENTS.md at the repo root. It tells the agent the app layout (app/ frontend + server/ Express), the hard rules (bind ASTRODOCK_PORT, routes under /api, add GET /health), the app.json manifest, the reserved ASTRODOCK_* env model, and the deploy lifecycle. Tell the agent to read it first.

Per-App AGENTS.md and CLAUDE.md

The starter template emits its own AGENTS.md + CLAUDE.md into every new app. So once the agent scaffolds from the starter, the repo it's working in already carries the conventions. An agent opened in that folder knows the rules without you repeating them.

The Loop the Agent Runs

With the token, the env vars, and the contract, the agent runs this loop:

  1. Scaffold from the Starter

    Copy examples/starter-app into a new repo and keep the app/ + server/ layout (the runner auto-detects it).

  2. Write app.json

    Set the slug, subdomain, runtime, and the resource modes (auth / database / storage each internal / external / none). Declare env-var names only, never secret values.

  3. astrodock apply

    Creates the app, connects the repo, and provisions resources and routing in one pass.

  4. astrodock set-secret for Required Secrets

    If app.json declares required secrets, or a resource is in external mode, set those values. The CLI tells the agent exactly what's missing.

  5. astrodock deploy:watch

    Triggers a deploy and streams the log until success or failure. This is how the agent confirms the launch: it can read the terminal status and react.

  6. Confirm Success

    Done when deploy:watch ends in success and https://<subdomain>.<base-domain> serves the app.

An Example Prompt

Open your agent in the Astrodock repo (with the two env vars set) and give it something like:

Read AGENTS.md, then build a small "link shortener" app and launch it on this
Astrodock platform.

- Scaffold from examples/starter-app into a new folder.
- Use platform auth, an internal database, and no object storage.
- Write app.json (slug "shortener", subdomain "go").
- Run: astrodock apply, set any required secrets, then astrodock deploy:watch.
- Stop when deploy:watch reports success and tell me the live URL.

The agent reads the contract, scaffolds, writes the manifest, runs the CLI, watches the deploy log, and reports back the live URL, without you driving each command.

What the Agent Can and Can't Do

The token is the boundary, and its scopes decide what it can do. With a Deployer key, the usual one to make by hand, an agent can:

  • Create and update apps from app.json (apply).
  • Trigger and watch deploys (deploy, deploy:watch).
  • Set env-var values, including secrets (set-secret).
  • Read status, logs, and the app list (status, logs, apps).

It cannot:

  • Manage end users: that needs the users:write scope, which is in the Operator preset and in keys from astrodock login, not in Deployer.
  • Manage other tokens (mint or revoke them). No preset can.
  • Touch apps outside its scope, if you scoped the token to specific slugs.

A Deployed App Runs Real Code

By design, the platform builds and runs whatever the agent commits: its dependencies, its buildCommand, and its runtime. That's the whole point, and it's also why you should only let agents work against repos and prompts you trust. See the Security page for the full model.

After a Successful Launch

If the app uses platform login (auth.mode = platform), someone has to give people access to it. A key from astrodock login can invite new people to its app. Giving access to someone who already has an account waits for your approval. With a Deployer key, you do it in the dashboard: create a user and grant them access to the app's slug. See Manage users & access.

Smaller Than an App: Artifacts

For a tracker, a sign-up sheet or a dashboard with no server code of its own, an agent can build an artifact instead: HTML, CSS and JavaScript plus a manifest that declares the data and who may do what. Point the agent at artifacts.md (https://docs.astrodock.ai/artifacts.md). On the hosted service, the agent gets its own artifacts-only key with npx @astrodock/cli artifacts login --email ….

Next Steps