
# Recommended stack

For a new app, use TypeScript: a React UI built with Vite, and one Node 24 server that serves it and the API under `/api` on `PORT`. Agent Cloud builds it with no Dockerfile, and `agc init --name <name> --stack typescript` writes a starter in that shape.

Success: `agc init` answers `"linked": true` with a `"starter"` version, `agc up --detach` a `url` you can open, and `agc ship` `"outcome": "live"` with exit 0.

## Ask your agent

```text
Build me a small app on Agent Cloud for booking spots at our summer camps. Use the
recommended stack (TypeScript, React with Vite, one Node server), start from the
Agent Cloud starter, and get it running on my mirror before you ship.
```

`agc init` may print a claim link for you to open if the app isn't in your organization yet. The first `agc ship` sends you an approval link.

## Steps

TypeScript (the default in an empty folder):

```bash
mkdir camp-bookings && cd camp-bookings
agc init --name camp-bookings --stack typescript
npm ci
agc up --detach
agc check
agc ship
```

For a Python server with the same React UI, use `--stack python` and install with `uv sync && npm ci` ([Python apps](/docs/build/python-apps.md)).

`agc up` also installs from stale lockfiles ([Dependencies and install scripts](/docs/build/env-mirror-and-shell-environment.md#dependencies-and-install-scripts)). For a folder with code, `agc init --name <name> --bring` infers the manifest instead; without `--bring` it fails with `init.not_new_folder` ([Quickstart: an existing app](/docs/getting-started/quickstart-existing-app.md)).

## How it works

With no Dockerfile and a `package.json` at the root, the Node default image runs `npm ci`, `npm run build --if-present`, `npm prune --omit=dev`, then `npm start` ([How your image is built](/docs/build/how-your-image-is-built.md)). Node and uv (Python) projects get a default image; for any other language, commit a Dockerfile and it is used as is. One server for UI and API means one port, one health check and one cookie origin. On a mirror, Vite in middleware mode inside it reloads both. Schema changes are plain SQL in `migrations/`, so no ORM migrator sits in the release path.

**The script contract.** Agent Cloud runs three `package.json` scripts:

| Script | Run by | Must |
|---|---|---|
| `dev` | `agc up` (`npm run dev`), unless `[service.web]` sets `dev` or `command` | Serve UI and API on `PORT`, reload on save |
| `build` | The default image (`npm run build --if-present`) | Produce what `start` needs (the starter's `web/dist`) |
| `start` | The default image, unless `[service.web] command` is set | Start the production server |

`agc up` runs a `[service.web] dev` through `sh -c`. With neither `dev` nor a `dev` script, it runs `command` (or `npm start`), adding `--watch` to a plain `node …` start. Keep `start` a plain `node <file>` so the image's launcher, not npm, runs it and SIGTERM reaches your server (see PID 1 and signals in [How your image is built](/docs/build/how-your-image-is-built.md#how-it-works)). The TypeScript starter's `start` is `node server/main.ts`: Node 24 runs the server's TypeScript directly, so only the UI is built.

**Validation.** Check every request body with a schema, and answer 400 when it doesn't fit. Use Zod 4 through `@hono/zod-validator` (write `z.email()`, not Zod 3's `z.string().email()`), or a Pydantic body model in FastAPI. The starters do this so that agents copying a route copy the check too.

What the app reads at run time (`PORT`, the database URL, email and sign-in variables) is in [App runtime contract](/docs/reference/app-runtime-contract.md#environment-variables).

## Starters

A starter is a complete, small app that `agc init` writes into an empty folder: a welcome page at `/` and a Notes example at `/notes`. It already has sign-in, a job queue and worker, email, migrations, a seed, checks, JSON logs and graceful shutdown, so the agent edits a working app instead of assembling one.

| Step | What `agc init --stack` does |
|---|---|
| Check | Needs `--name` and an empty folder: only `.git`, `.DS_Store`, `Thumbs.db`, `desktop.ini`, `.claude`, `.cursor`, `.vscode`, `.idea` and `.zed` may be there, and an `AGENTS.md` or `CLAUDE.md` counts as not empty. Inside another app it fails with `init.already_app` |
| Download | One pinned release of [summationai/agc-starters](https://github.com/summationai/agc-starters), checked against a sha256 compiled into agc; there is no "latest". `AGC_STARTERS_URL` can point at a mirror or offline copy, but the sha256 must still match |
| Unpack | In memory. Only plain files, folders and pax headers pass; a link, device, absolute path, `..`, `.git` segment or case-folded duplicate invalidates the archive |
| Link | Creates the app and its production database. A taken name has written nothing yet, so rerun with another name |
| Write | Exclusively, never over a file or through a symlink; a write error removes everything this run created |

| The folder gets | |
|---|---|
| The stack's files | `[app] name = "starter"` replaced by your name, then a `starter = "<stack>@<version>"` line (shown by `agc status`, never changed later) |
| `AGENTS.md` | The starter's stack section plus Agent Cloud's |
| `STARTER-LICENSE` | The starter code's MIT notice; your app isn't MIT-licensed |
| `.gitignore` | `.env.mirror` added |

The starters repo's `SPEC.md` and the other stack aren't copied. The manifest has no `mask` list: the database starts empty, and default masking covers columns like `users.email` by shape.

**Which stack.** Pick TypeScript unless the server needs Python's data libraries. An organization default stack applies to `agc init --name` in an empty folder. The envelope then says `"stack_defaulted": true, "stack_default_from": "org"`.

| | `typescript` | `python` |
|---|---|---|
| Server | Hono on Node 24 | FastAPI on uvicorn, Python 3.12, psycopg 3 |
| `[service.web] dev` | `npm run dev` | `./dev.sh` (Vite on `PORT`, API on `PORT+1`) |
| `[service.web] command` | none (`npm start`) | `python -m app` |
| `[service.worker]` | `node server/worker.ts`, dev `npm run worker:dev` | `python -m app.worker`, dev via `watchfiles` |

Both serve health on `/api/health`. They share the React UI, `migrations/0001_init.sql` (`users`, `sessions`, `notes`, `jobs`), a `seed.sql` (a demo person and three notes, for a mirror that starts empty), one racing smoke flow and one invariant.

## Errors

Every code, its exit and fix: [Error code catalog](/docs/reference/error-code-catalog.md).

A version that doesn't start fails the ship with `ship.rehearsal_failed` or `ship.release_failed` and a `cause`. The previous version keeps serving, but migrations applied before a release-start failure stay applied. `agc logs --release <op>` has the scrubbed log lines. Causes this stack hits:

| `cause` | Means | Fix |
|---|---|---|
| `loopback` | The server listens on `127.0.0.1` only | Listen on `0.0.0.0` (or omit the host), on `process.env.PORT` |
| `wrong_port` | Not on `[service.web] port` | Listen on `process.env.PORT` |
| `dev_dependency` | The server imports a package only in `devDependencies`, which the image prunes | Move it to `dependencies` (the starter's `vite` and `react` are rightly dev-only) |
| `file_missing` | `start` needs a file not in the release, often build output | Build it in `build`, or run the source |
| `module_format` | ES modules and CommonJS mixed | Pick one |

```json
{
  "ok": false,
  "product": "agent.cloud",
  "command": "init",
  "error": {
    "retryable": false,
    "code": "init.folder_not_empty",
    "message": "A starter goes into an empty folder, and this one has README.md, src.",
    "fix": "Move them aside, or run this in a new, empty folder. To bring existing code instead, run `agc init --name <name>` without --stack."
  },
  "next": [{ "cmd": "agc init --name camp-bookings --stack python", "why": "run again once the folder is empty" }]
}
```

## Limits

The starter download times out after 30 s and may be at most 5 MB. Unpacked, it may hold at most 50 MB and 5000 entries.

## Agent notes

- `agc up` reports `data.runtime` as native: your `dev` command on this machine, not production's image. A green mirror doesn't prove the image starts; the rehearsal does.
- Create schema changes with `agc migration new <slug>`; don't add Prisma Migrate, drizzle-kit or another migrator.
- Copy the starter's routes for new ones: JSON bodies only, a schema check, `__Host-` cookies outside a mirror. The welcome page and notes are disposable; the plumbing isn't.
- Don't remove the starter's smoke flow without a replacement: every invariant needs a racing flow, and `agc check` warns when one is missing.
- `agc init --name <name>` in an empty folder always writes a starter (TypeScript, or the organization's default stack). To start from existing code, use `--bring` in that folder.

## Related

- [Python apps](/docs/build/python-apps.md)
- [How your image is built](/docs/build/how-your-image-is-built.md)
- [Local development with agc up](/docs/build/local-development-with-agc-up.md)
- [Migrations](/docs/data/migrations.md)
- [Quickstart: a new app from an empty folder](/docs/getting-started/quickstart-new-app.md)
- [New-app defaults](/docs/owners/new-app-defaults.md)

<!-- feedback:start -->
---
Wrong, outdated or unclear? Run `agc feedback docs "build/recommended-stack: <what is wrong>" --body <file>` with the sentence quoted in the file. No code or app data is sent.
<!-- feedback:end -->
