# Embedding Chatty in a Shared Web Project

> Don't commit a local-Coda URL — point the Chatty embed at the Continuo hub (env-driven) so it works for everyone, with no Coda required.

When you add the **Chatty** widget to a codebase your team/users share (and commit
it via git), the embed must point at the **Continuo hub**, not your **local Coda**.
Otherwise everyone who pulls the repo or visits the deployed site gets a widget
aimed at a backend that only exists on your machine.

> **The rule: don't commit a local-Coda URL. Point the embed at the hub
> (env-driven), and the widget works for everyone — no Coda required.**

- **Local-mode Coda serving Chatty is a _private preview_ only** (dev token, your
  machine) — not shareable or deployable.
- **The real, multi-user backend is the Continuo hub.** End users just load the
  page; Coda is the *developer's* coding agent, not something users need.

## What to commit
Load `chatty.js` **from the hub** with your Continuo project UUID. `chatty.js`
takes its `BASE_URL` from its own `<script src>` origin, so its `/api/chatty/*`
calls go to the hub:

```html
<script src="https://<your-hub>/static/chatty/chatty.js" data-project="<continuo-project-uuid>"></script>
```

## Make the URL environment-driven (one commit, dev + prod)
`chatty.js` resolves `BASE_URL` as `window.CHATTY_BASE_URL` -> `data-base-url` ->
script origin. Set the global per environment **before** the tag so you never
hardcode your machine:

```html
<script>window.CHATTY_BASE_URL = "{{ CHATTY_BASE_URL }}";</script>  <!-- prod=hub, local dev=your Coda -->
```

Dev-you previews against local Coda; staging/prod point at the hub — same code.

> A shared widget needs a shared backend: register the project in **Continuo**
> (Company side) for a stable project UUID. Pure Local mode can only back the
> widget for you, on your machine.
