# 🐾 Toes

Personal web appliance you run on your home network.

Plug it in, turn it on, and forget about the cloud.

## Development

```bash
bun run dev      # Hot reload (rebuilds client bundle on change)
bun run start    # Production mode
bun run check    # Type check
bun run test     # Tests
bun run build    # Build client JS bundle
bun run release  # Build a release tarball for the Pi
```

### Releasing

`bun run release` builds everything the Pi needs into a single tarball:

1. Client JS bundle (`pub/client/index.js`)
2. Embedded templates (`src/lib/templates.data.ts`)
3. Pre-built bare git repos for bundled apps (`dist/repos/`)
4. Cross-compiled CLI binary for linux-arm64 (`dist/toes`)

Output: `dist/toes-<version>.tar.gz`

The Pi does zero building — it untars, runs `bun install`, and starts. Upload the tarball to wherever `RELEASE_URL` in `install/install.sh` points (currently `https://toes.dev/release/latest.tar.gz`).

### Scripts

| Script | What it does |
|--------|-------------|
| `scripts/build.sh` | Builds the client JS bundle into `pub/client/index.js` |
| `scripts/build-repos.sh` | Pre-builds bare git repos for bundled apps in `dist/repos/` |
| `scripts/release.sh` | Full release: client + templates + repos + CLI → tarball |
| `scripts/build.ts` | Builds the CLI binary (current platform or cross-compile) |
| `scripts/embed-templates.ts` | Generates `src/lib/templates.data.ts` from `templates/` |
| `scripts/setup-ssh.sh` | Configures SSH access for the `cli` user on the Pi |
| `scripts/remote-install.sh` | Runs the installer on a remote Pi over SSH |

## Setup

Toes runs on a Raspberry Pi 5 with a `toes` user and passwordless sudo.

```bash
curl -fsSL https://toes.dev/install | bash
```

The installer downloads the release tarball, installs bun and system packages, runs `bun install` for the server and all bundled apps (in parallel), copies the pre-built CLI and git repos into place, and starts the systemd service.

Dashboard: `http://<hostname>.local`

## Features

- Hosts Bun/Hype webapps (SSR and SPA)
- `git push` Heroku-style deploys
- Web dashboard with real-time status, logs, and tools
- `toes` CLI (local install or SSH)
- Per-app environment variables, cron jobs, metrics
- Public sharing via tunnels

## SSH CLI

Manage your server from any machine on the network — no install required.

```bash
ssh cli@toes.local           # interactive shell with tab completion
ssh cli@toes.local list      # run a single command
ssh cli@toes.local logs fog  # stream logs for an app
```

## CLI Configuration

By default, the CLI connects to `localhost:3000` in dev and `toes.local:80` in production.

```bash
toes config                                  # show current host
TOES_URL=http://192.168.1.50:3000 toes list  # connect to IP
TOES_URL=http://mypi.local toes list         # connect to hostname
```
