> ## Documentation Index
> Fetch the complete documentation index at: https://docs.capsule.new/llms.txt
> Use this file to discover all available pages before exploring further.

# Deploy An App

> Serve locally, create workspace resources, and deploy the same Capsule app definition.

Capsule uses the same Python entry point for local development and hosted deploys.

`capsule serve app.py:app` starts the local dev loop. `capsule deploy app.py:app` ships the app. In hosted mode, Capsule runs the app in isolated per-user runtimes so each app user has their own sandboxed execution context.

## 1. Confirm the entry point

```bash theme={null}
capsule serve app.py:app
```

`app.py:app` means:

* module: `app.py`
* symbol: `app`

Serve uploads the project, boots the app runtime, and hot-reloads as you edit watched files.

## 2. Create required resources

Create any resources your app declares before deploy:

```bash theme={null}
capsule secret create OPENAI_API_KEY=sk-...
capsule fs create reports
capsule channel create support-telegram --type telegram -c bot_token=123:ABC
```

Then reference them in code:

```python theme={null}
app = cpsl.App(
    name="support-ops",
    image=cpsl.Image(python_packages=["openai"]),
    channels=[cpsl.Channel("support-telegram")],
    secrets=["OPENAI_API_KEY"],
    filesystems={"/data": cpsl.FileSystem("reports")},
)
```

## 3. Deploy

```bash theme={null}
capsule deploy app.py:app
```

Deploy sends the app definition, runtime image, source archive, pages, integrations, schedules, secrets, filesystems, channels, and product settings to Capsule.

The output includes the hosted URL.

## 4. Know what changes in hosted mode

The code stays the same, but requests now come from the hosted app:

* users sign into this app's own user pool
* `session.user` is the current app user
* `access="authenticated"` pages are gated
* workspace secrets are resolved in the managed runtime
* each app user gets an isolated runtime for agent work
* filesystems and container-local files are available to code running in that runtime
* declared channels can deliver messages to the app

## 5. Iterate

Make changes locally, serve again, then deploy the same entry point when ready.

```bash theme={null}
capsule serve app.py:app
capsule deploy app.py:app
```

## Next steps

* Use [Troubleshooting](/troubleshooting) if serve or deploy fails.
* See the [CLI Reference](/reference/cli) for every command.
* Read [SDK And Runtime Versions](/sdk-runtime-versions) if local and hosted behavior diverge.
