# Files in the cloud

> Push the board to a hosted git repository and everyone with a clone works from it, from laptops, agent sandboxes and CI, with optional live updates and a hosted board.

Canonical: https://kanb.us/ways-to-run/files-in-the-cloud.html

## How it works

The board is the same `project/` folder as in [local files](/ways-to-run/local-files.html), pushed to GitHub, GitLab or any git host. A person on a laptop, an agent in a cloud coding sandbox and a CI job each have a clone and use the same `kbs` commands. Git moves changes between clones when someone pushes.

Two optional layers sit on top. A shared MQTT broker announces every change the moment it happens, so other clones show it before they pull. A hosted board on AWS serves the pushed board in a browser, behind a login, for people who never clone the repository.

:::note{title="What is preview here"}
Sharing the board through git works today: it is ordinary files and ordinary pushes. The hosted board is the preview part. Edits made in it are written only to its cloud copy and never pushed back to git, so the next sync can overwrite them. Treat it as read-only and make changes with the CLI in a clone.
:::

## Set it up

:::step-list
:::step
**Set up a local board first.** Follow [local files](/ways-to-run/local-files.html), and give the board a project key that is unique to this repository. Live updates are routed by project key, so two repositories that share one see each other's changes.
:::
:::step
**Push it to a hosted repository.**

```bash
git remote add origin git@github.com:acme/website.git
git push -u origin main
```
:::
:::step
**Join from another clone**, whether that is a teammate's laptop, an agent sandbox or a CI job. Each clone only needs a Kanbus CLI.

```bash
git clone git@github.com:acme/website.git
cd website
kbs setup env KANBUS_USER --value bob@example.com
kbs list
```
:::
:::step
**Work in a pull, change, commit, push loop.** Each issue is its own file, so new issues from different clones never conflict. Agents should run `kbs commit` and push at the end of every task.

```bash
git pull
kbs update acme-aeec87 --status in_progress
kbs commit
git push
```
:::
:::step
**Optional: add live updates.** Point every clone at the same MQTT broker in `.kanbus.yml`. Your files stay the source of truth; the broker only carries notifications.

```yaml
realtime:
  transport: mqtt
  broker: mqtt://broker.example.com:1883
  autostart: false
```
:::
:::step
**Optional: add a hosted board.** Deploy the AWS stack in `infra/cloud`, add a GitHub push webhook for the repository, and give each person the Cognito attributes for that board.
:::
:::

[Read the full guide](https://github.com/AnthusAI/Kanbus/blob/main/docs/GETTING_STARTED.md) [Read the hosted board runbook](https://github.com/AnthusAI/Kanbus/blob/main/docs/CLOUD_CONSOLE_RUNTIME.md)

## Good to know

- If two clones change the same issue between pushes, `git pull` reports a conflict in that issue's file. Keep the pushed version, then repeat your own change with `kbs`, and run `kbs validate` to confirm every file parses.
- For work several agents might pick up at once, use `kbs coordination` so only one of them claims an issue.
- One sign-in maps to one hosted board today.
