# Apps

An app is one service that Astris builds from a Git repository and runs: a web app, a worker, a cron job or a static site. Each app lives in a project. Your coding agent manages apps with the Astris MCP tools, and you can do the same with the Astris CLI.

## Deploy an app

The MCP tool `deploy` creates an app from a Git URL and queues its first deploy. With the CLI, pass these four flags to `astris deploy`:

- `--project`
- `--name`
- `--git-url`
- `--branch`

`--git-url` is a public http or https URL, or an SSH URL for a private repository in the form `ssh://git@host/owner/repo.git`. A Git URL with a user name or a password is refused with `The Git URL must not include a user name or password.`

For a private repository, Astris creates the app and gives you a deploy key. The CLI then prints: `Add this public key to the repository as a read-only deploy key, then deploy again with this app_id. On GitHub the key goes in the repository Settings under Deploy keys, and write access stays off.`

`--wait` waits until the deploy ends, then prints `done`, `error` or `cancelled`. A deploy that is still running when the wait stops prints `still running, check status`.

## Builds

- `--build nixpacks` builds with Nixpacks. This is the default.
- `--build dockerfile` builds from the Dockerfile that `--dockerfile` names.
- `--build static` serves static files. `--publish-directory <dir>` names the directory to publish, and `--spa` serves it as a single-page application.

## Kinds

- `--kind web` is the default kind. A web app can have an address.
- `--kind worker` runs `--command` as the container's process. A worker has no address.
- `--kind cron` runs `--command` on `--schedule`, five space-separated fields.

A worker or a cron app cannot use `--build static`. The kind, the build and the port are set when you create the app.

## Redeploy

```
astris deploy --app <id>
```

`astris deploy --app <id> --hook` prints the push-to-deploy hook URL of the app. The URL is a credential: keep it private.

## Status

```
astris status --app <id>
```

It prints the status and the hostnames of the app.

## Environment variables

```
astris env --app <id>
```

It reads one JSON object from standard input and replaces the whole variable set. Names you leave out are removed. To see only the names, run:

```
astris env --app <id> --names
```

## Start, stop and restart

```
astris app start --app <id>
astris app stop --app <id>
astris restart --app <id>
```

## Remove an app

```
astris app remove --app <id> --confirm <name>
```

`--confirm` must equal the app's name exactly. A different name is refused with `The name does not match the application.` and nothing is deleted. Removing an app deletes it and its data. Its databases and storage buckets are separate and are not removed.

## Compose stacks

Compose stacks are not available in the private preview. Deploy each service from your compose file as an app, and create a [database](/docs/databases) for a database service. See [compose_unavailable](/docs/errors/compose_unavailable).
