# SmallHost

This is the complete deploy guide for agents (the same text is at https://smallhost.dev/llms.txt). From the project directory, run:

```sh
tar czf - --exclude=node_modules --exclude=.git --exclude=.smallhost . | curl -sS -X POST "https://smallhost.dev/v1/deploy?name=my-app" -H "Content-Type: application/gzip" --data-binary @-
```

There is nothing to install or sign up for: it needs only `tar` and `curl`, so no code from SmallHost runs on your machine. It uploads the project, waits until the app is serving, and answers JSON with its public `url`; give that URL to your human. The first time, it also creates an account: run the `save_key` command from the answer (it writes the key to `.smallhost`, readable only by you, and adds that file to `.gitignore`), and ship every later change with the answer's `redeploy` command, which sends the key. `node_modules`, `.git` and `.smallhost` stay behind; other files ship, so leave out anything that shouldn't, such as a `.env`.

Apps don't need changes for SmallHost: hard-coded ports, missing start scripts and undeclared dependencies are handled for Node, Python (Flask, FastAPI or plain scripts) and static sites. If a deploy fails, the answer's `error.message` and `error.fix` say why and what to change, `error.deploy.logs` has the app's output, and the previous version keeps serving.

Options go in the same URL: `name` (lowercase letters, digits and hyphens), `database=postgres`, `mysql` or `mariadb`, and `auth=@yourcompany.com` so only people with those emails can open the app. Everything else is one request with the key (`. ./.smallhost`, then `-H "Authorization: Bearer $SMALLHOST_KEY"`) to `https://smallhost.dev/v1/projects/my-app`: `GET` for status, `GET /logs`, `PUT /secrets` with `{"NAME": "value"}`, `PUT /config` (settings the app reads live), `POST /share` with `{"email": "alice@example.com"}` (they get an email with a link that signs them in; `PATCH /share` with `{"access": "people"}` keeps everyone else out), `PATCH` with `{"auth": ...}` or `{"paywall": "$5/month"}` (charge visitors), `GET /users` and `GET /sales`. `POST https://smallhost.dev/v1/account/links` with `{"purpose": "dashboard"}` returns a link your human uses to see and manage every app. A `402` answer means your human needs to act: send them the link it carries.

Sharing: the URL is public, so anyone with the link can open it. It's free to start: 3 apps, 10 revisions each, and free apps last 7 days.

A CLI wraps the same calls (`npx -y smallhost deploy`, Node 18+) if your human prefers one; it's optional.

## After it's live

- Sign-in: with `auth`, visitors sign in with an emailed code and your app reads who they are from the `X-SmallHost-User-Email` header. Changing `auth` applies at once, with no redeploy.
- Data that must survive redeploys: add `database=postgres` and use the `DATABASE_URL` environment variable. Memory and local files (including SQLite) are wiped on every deploy.
- API keys: `PUT /secrets`, or `POST /v1/account/links` with `{"purpose": "secret", "project": "my-app", "name": "OPENAI_API_KEY"}` for a link your human uses to set it without you ever seeing it.
- https://smallhost.dev/llms-full.txt documents every endpoint, including deploying a container image you push.