# <img src="https://raw.githubusercontent.com/yukimemi/engawa/main/assets/logo.svg" alt="Engawa" width="240" height="64">
Drop into a public chat room from your editor or browser. Everyone shares a lobby, but nobody needs to host it. The `engawa` binary runs a peer while you're using it; the browser dashboard and Neovim plugin are two ways to talk to that peer.
## Get started
Install [engawa-chat](https://crates.io/crates/engawa-chat) with Cargo, then open the dashboard:
```sh
cargo install --locked engawa-chat
engawa web
```
Select a room in the dashboard, or create one and choose whether it keeps history. Stop the process with Ctrl-C. The browser UI runs on your own machine, not on a hosted website. For Neovim, see [engawa.nvim](https://github.com/yukimemi/engawa.nvim).
Engawa uses [kaishin](https://github.com/yukimemi/kaishin) to check for a binary update in the background when you open the dashboard or start an editor session. Checks are throttled to once per day. Updates do not interrupt chat; the new executable takes effect on the next launch. Run `engawa self-update` to update immediately without a prompt, or `engawa self-update --check` to check only. Set `ENGAWA_NO_AUTOUPDATE=1` to disable background updates. Mobile guests load the deployed web client instead; they do not install a CLI.
### Desktop configuration
The CLI, desktop web dashboard, and Neovim use the same optional TOML configuration. Place `config.toml` in `$XDG_CONFIG_HOME/engawa` if that variable is an absolute path. Otherwise the default is `%APPDATA%/engawa` on Windows, `~/Library/Application Support/engawa` on macOS, or `~/.config/engawa` on Linux. Engawa never searches the current project for a config. Without a file, existing defaults apply.
```toml
auto_update = true
# data_dir = "profiles/personal" # relative to the config directory
# invite_base = "https://yukimemi.github.io/engawa/"
[vars]
work_room = "Rust"
[[favorites]]
name = "{{ vars.work_room }}"
history = true
[[favorites]]
name = "もくもく"
history = false
```
Favorites appear first in declaration order, even if no one is online. They do not join or advertise a room. The same name with a different history policy is a separate room; duplicate favorites appear only once. Mobile guests do not receive the host's preferences.
[`teravars`](https://github.com/yukimemi/teravars) loads `config.toml`, then alphabetical `config.*.toml` overlays, then `config.local.toml`. Standard template helpers, `[vars]`, and relative `include = ["common.toml"]` are supported; shell execution is not enabled. `engawa --config <file-or-directory> web` or `ENGAWA_CONFIG` selects a different config. An explicit file loads just that file and its includes.
`--data-dir` takes precedence over `ENGAWA_DATA_DIR`, which takes precedence over `data_dir` in TOML. `ENGAWA_INVITE_BASE` overrides `invite_base`; setting `ENGAWA_NO_AUTOUPDATE` disables background updates regardless of `auto_update`. Explicit `self-update` is independent of the chat configuration.
### Your own veranda
With no `[veranda]` section, you join **みんなの縁側**, the public lobby. To start a separate, invitation-only space, create a **new** config file in a private directory:
```sh
engawa veranda new "yukimemi さん家の縁側" --out my-veranda.toml
engawa --config my-veranda.toml web
```
The file contains a `[veranda]` name and a randomly generated 32-byte key. `--out` refuses to overwrite an existing file; without it the command prints the secret configuration to stdout. Do not commit the file. To use it with Neovim, set `ENGAWA_CONFIG` before starting the editor. Another native peer can use the same configuration. Renaming the veranda does not change its membership; using a different key creates a different veranda and history.
Share the dashboard's invitation via a private channel. The **whole link is a bearer key**, even for a direct room invitation: anyone who receives or forwards it can access that veranda's lobby and rooms. The name is a sign, not a verified owner identity. Public and private rooms with the same name have separate IDs and history. To stop using a leaked key, generate a new one and redistribute it; there is no per-person revocation, and already received copies cannot be erased.
The invitation's `#` fragment is consumed by the browser, not sent to the static site's HTTP server. It is still visible to anyone with the URL, browser history, clipboard, or access to the hosting page's scripts. Private gossip payloads are authenticated and encrypted with keys derived from the veranda secret. This does not hide the existence or IP addresses of peers from the underlying network, nor encrypt history at rest.
### Create or switch verandas on a phone
Open [Engawa in your browser](https://yukimemi.github.io/engawa/) and choose **みんなの縁側** to meet other people. Everyone sees this same public veranda at the top, even in a fresh browser profile. It cannot be renamed or forgotten. Opening the picker alone does not connect you; you choose when to join. You can also create an invitation-only veranda on your phone.
Tap the veranda name in the header to browse your saved verandas. Closing the picker or choosing the current veranda returns to the same screen: your chat stays connected, incoming posts continue to arrive, and unsent text stays in the composer. Opening the picker on a hosting phone does not stop friends from joining.
Creating a private veranda saves it; another person's private invitation is saved only when you choose to save it after joining. Choosing a different veranda switches the connection. If this phone is hosting, Engawa asks before closing that host. Renaming changes only a private entry's local label. Forgetting it does not revoke invitations or erase other participants' history. Public invitations lead to the same built-in veranda, not a second saved entry.
On the creating phone, keep the tab open while someone joins. A locked phone, a suspended tab, or switching to another veranda may make that invitation temporarily unreachable. Reopen the original entry in the same browser to host again with the same invitation. Hosting is limited to one tab per veranda. The membership key and a separate private hosting identity are kept in IndexedDB; clearing site data or forgetting the owned entry removes the hosting identity. An invitation grants membership, not a backup of the hosting identity. Use a trusted browser profile, not a shared device.
### Invite someone on a phone
The desktop dashboard offers two links. **Invite to lobby** works even when the desktop has not joined a room. **Invite to room** opens one particular room. Share the link from the dashboard, not the address bar. No CLI, VPN, or shared Wi-Fi is required on the phone.
An invitation shows the destination before it connects. A direct room invitation also shows the room name and history policy. Once inside, use the room-list control to leave just the room and stay on the veranda. Leaving a live-only room discards its in-memory conversation. Disconnecting from the veranda is a separate menu action.
The phone runs its own iroh endpoint and signs its own posts; it never receives a native peer's local API token. Both link types carry a bootstrap endpoint and relay; private invitations also contain a veranda membership key. Keep the inviter online for a link's initial connection. The permanent public entry, unlike a link, can start with zero other participants and discover arrivals.
Room listings come from signed gossip announcements, not a central directory. To reach a participant on another relay, the mobile lobby can use iroh's public address lookup for an endpoint ID and relay address. Room names, policies, and chat messages are not published to that lookup service.
For invitation-free discovery, the public browser entry and desktop's default public node use [Nostr ephemeral events](https://github.com/nostr-protocol/nips/blob/master/01.md) as a meeting point. Native peers also retain Mainline DHT discovery. The Nostr relays see public session endpoint IDs, iroh relay addresses, freshness timestamps, proofs, and normal connection metadata such as IP addresses. They do **not** carry the list of rooms, chat messages, history, private veranda names, or membership keys. Engawa rejects stale announcements; ephemeral delivery does not guarantee a third party never records them. Joining a private veranda does not use this meeting point. If discovery relays are unreachable, finding new peers may fail; existing invitations still work independently.
In a retained room, the guest stores its room-specific signing key and recent signed posts in this browser's IndexedDB. Rejoining from the same browser profile and site restores the conversation, including the ability to withdraw your own saved posts. Clearing the site's data also clears those local copies and keys. Private browsing or browser storage eviction can remove them sooner. Live-only rooms never write their posts or keys to IndexedDB.
### Host the static invite page
The `invite-pages.yml` workflow builds the browser guest and deploys it to GitHub Pages on `main` (select **GitHub Actions** under repository Settings → Pages). For another HTTPS static host, build the same bundle:
```sh
rustup target add wasm32-unknown-unknown
cargo install wasm-bindgen-cli --version 0.2.130 --locked
python browser/build.py
```
Serve the contents of `target/invite-site/` with `application/wasm` for `.wasm`. Before starting the desktop peer, set `ENGAWA_INVITE_BASE` to the URL of that page (default: `https://yukimemi.github.io/engawa/`). A loopback HTTP URL is also supported for local development. Only the static client is hosted: room discovery, messages and history do not pass through the static site.
For an opt-in end-to-end check, build the native binary and site, install Python Playwright and its WebKit engine, then run `python tests/browser_invite.py target/debug/engawa` (`.exe` on Windows). It uses a temporary profile, an actual HTTPS iroh relay, and a phone-sized WebKit browser. It does not announce the test room to the public lobby.
Run `python tests/browser_picker.py` for the phone-only path: two isolated WebKit profiles create, share, join and reopen a private veranda over a real relay with no native host. Pass `--site https://yukimemi.github.io/engawa/` to test the deployed site instead of the local build.
## What survives when everyone leaves?
Built-in rooms always appear in the lobby. Other rooms are announced by their participants. An activity indicator means a peer was seen recently, not that an exact number of people are online.
- **Live only:** The client keeps messages in memory while you're in the room and discards them when you leave.
- **With history:** Each peer keeps up to 200 posts per room from the last seven days (SQLite on desktop, IndexedDB on mobile). Leaving does not erase copies that other participants already received. If Alice wrote a post alone, Bob cannot fetch it while Alice is offline; when both are back in the same room, their clients exchange missing signed posts and withdrawals without duplicating messages. Expired data is pruned when the store is used again.
The history policy is part of the room ID. Two rooms can share a display name without sharing messages. Withdrawing your own post sends a signed removal notice; it can't erase screenshots, backups, or copies kept by other clients.
The default profile lives under `engawa` in your OS's local application data directory. Use `engawa --data-dir <directory> web` or set `ENGAWA_DATA_DIR` to choose another profile. Use separate directories for independent peers.
## Network and privacy
Engawa discovers lobby peers through the Mainline DHT with `distributed-topic-tracker`, connects over iroh, and uses `iroh-gossip` for room announcements and messages. Chat logs are not published to the DHT. Networks that block UDP may prevent public peer discovery.
No account or real name is required. Anyone in a veranda can read and record the rooms they join. Encrypted transport does **not** hide your IP address from a direct peer, and the local database is not encrypted.
## Connect another editor
Start `engawa serve --stdio` as a child process. Read one line of JSON from stdout: `{"url":"http://127.0.0.1:<port>","token":"…"}`. Keep stdin open for the session; closing it stops the child. The API listens only on a randomly assigned loopback port. Send `Authorization: Bearer <token>` with each request.
| Method | Path | Request or response |
|---|---|---|
| GET | `/api/state` | Poll for `rooms`, `room` (current ID or null), `messages`, and `status`. |
| POST | `/api/rooms` | `{"name":"Tea room","history":true}` — create and enter. |
| POST | `/api/join` | `{"id":"<room id>"}` |
| POST | `/api/leave` | `{}` |
| POST | `/api/send` | `{"text":"Hello"}` |
| POST | `/api/retract` | `{"id":"<your message id>"}` |
Use `Content-Type: application/json` for POST requests. A successful action returns `204 No Content`; it is not a delivery receipt.
## Run the checks
```sh
cargo test --bin engawa
cargo build --bin engawa
python tests/peers.py target/debug/engawa
```
On Windows, pass `target/debug/engawa.exe`. The integration test uses temporary profiles and ephemeral ports, without posting to the public lobby. Leave `ENGAWA_PEER` unset for normal discovery, set it to an empty string for a loopback seed, or set it to `<endpoint-id>@127.0.0.1:<port>` to connect to that seed.