---
title: Self-host
description: Run Shed for your company on any server with a disk and wildcard DNS: settings, TLS, email, backups and upgrades.
---

Shed is one Node process and one data folder: a SQLite file (`shed.db`) plus the files of every app version (`apps/`). Anything that can run a container with a disk and wildcard DNS can run it.

You need:

1. **A domain with wildcard DNS.** Shed lives at `shed.example.com`, and each app gets its own subdomain, `<app>.shed.example.com`. That is what keeps apps isolated from each other, so it isn't optional.
2. **TLS for both.** A certificate for `shed.example.com` and a wildcard certificate for `*.shed.example.com`.
3. **A way to send email** for sign-in links. Shed sends it through the Resend API, the one provider supported today. Without it, links are printed in the server log, which is enough to sign yourself in on day one.
4. **A persistent disk** mounted at `/data`.

## Run it

```sh
git clone https://github.com/emergentai/shed && cd shed
docker build -t shed .
docker run -d --name shed -p 8080:8080 -v shed-data:/data \
  -e SHED_BASE_URL=https://shed.example.com \
  -e SHED_ORG_DOMAIN=example.com \
  -e SHED_ALLOWED_EMAILS=@example.com \
  -e RESEND_API_KEY=re_... \
  -e SHED_EMAIL_FROM="Shed <login@shed.example.com>" \
  shed
```

Without Docker: `npx shedcloud serve --base-url https://shed.example.com --data ./shed-data` (Node 22.13 or later).

Put any TLS-terminating proxy or load balancer in front that sends both `shed.example.com` and `*.shed.example.com` to port 8080 and keeps the `Host` header. The wildcard certificate usually needs a DNS challenge, so pick a proxy or certificate tool that supports your DNS provider.

## Settings

| Variable | Flag | What it does |
|---|---|---|
| `SHED_BASE_URL` | `--base-url` | The public address. Apps live at its subdomains. **Required in production.** |
| `SHED_APPS_URL` | `--apps-url` | Optional: a separate domain for apps, such as `https://example-apps.com`, so apps live at `<app>.example-apps.com` and the platform keeps `SHED_BASE_URL` to itself. Recommended when strangers can publish (see [Security](security.md#apps-on-a-domain-of-their-own)). Apps' old addresses under `SHED_BASE_URL` redirect to the new ones; team addresses stay under `SHED_BASE_URL`. Needs its own wildcard certificate and DNS. |
| `SHED_FREE_SUFFIX` | `--free-suffix` | With `SHED_FREE_PLAN`: `on` gives new free apps a short suffix (`standup-k7f2`). Team apps and people with full limits keep plain names. |
| `SHED_ABUSE_EMAIL` | `--abuse-email` | Optional: an address for abuse reports, shown on `/abuse` beside the report form. |
| `SHED_LEGACY_HOSTS` | `--legacy-hosts` | Domains this Shed used to live on, comma-separated. Pages and apps there redirect to the same path on `SHED_BASE_URL`; the API keeps answering, so CLIs signed in to the old address keep working. Keep their DNS and certificates. |
| `SHED_ORG_DOMAIN` | `--org-domain` | Your company's email domain. Turns on "everyone at example.com" sharing. |
| `SHED_ALLOWED_EMAILS` | `--allow` | Who may publish apps: emails and `@domains`, comma-separated. Leave empty to let anyone who can sign in publish. People an app is shared with can always sign in to open it. |
| `RESEND_API_KEY` | | Sends sign-in emails through Resend. |
| `SHED_FREE_PLAN` | `--free-plan` | Run Shed as an open cloud: anyone can sign up and publish within free limits, and the people in `SHED_ALLOWED_EMAILS` get your full limits. `on` for the defaults (3 apps, 5 MB deploys, 10,000 records and 10 MB of data per app, 5 versions), or override some: `apps=5,deploy_mb=2`. Keys: `apps`, `deploy_mb`, `records`, `data_mb`, `versions`. |
| `SHED_ADMIN_EMAILS` | `--admins` | Emails that may delete any app, to take down abuse on an open server (`shed rm <app> --yes`), see `/admin`, and create [teams](teams.md). |
| `SHED_TEAM_PLAN` | `--team-plan` | Limits for team apps when `SHED_FREE_PLAN` is on. `on` (the default) for 20 apps, 10 members, 25 MB deploys, 50,000 records and 100 MB of data per app, 10 versions; or override some: `apps=40,members=100`. Keys: `apps`, `members`, `deploy_mb`, `records`, `data_mb`, `versions`. Never above the server's own limits. |
| `SHED_GOOGLE_CLIENT_ID`, `SHED_GOOGLE_CLIENT_SECRET` | | Turn on **Continue with Google** (through [Better Auth](https://better-auth.com)). Make an OAuth client ("Web application") in the [Google Cloud console](https://console.cloud.google.com/apis/credentials) with the redirect URI `<SHED_BASE_URL>/api/auth/callback/google`. |
| `SHED_AI_KEY` (or `ANTHROPIC_API_KEY`) | | Turn on the **AI builder** at `/build`: people describe an app, Claude builds it, they try it in a sandboxed preview and publish it. Needs an [Anthropic API key](https://platform.claude.com). It uses Claude Sonnet 5.5. **Who can use it:** `SHED_AI_EMAILS`, a comma-separated list of emails and `@domains`, or `*` for everyone; unset, only the people in `SHED_ADMIN_EMAILS` can. Optional: `SHED_AI_EFFORT` (default `medium`), `SHED_AI_TURNS_PER_USER` (messages per person per day, default 40) and `SHED_AI_TURNS_PER_DAY` (for the whole server, default 400). The preview runs at `shed-preview.<apps domain>`, so that name needs to resolve like any app's. |
| `BETTER_AUTH_SECRET` | | Signs Google sign-in's short-lived state. 32+ random characters (`openssl rand -base64 32`). If unset, one is generated and kept in the data folder. |
| `SHED_EMAIL_FROM` | | The sender, e.g. `Shed <login@shed.example.com>`. Its domain must be verified in Resend. |
| `SHED_DATA` | `--data` | Where the data folder lives (`/data` in the image). |
| `PORT`, `HOST` | `--port`, `--host` | Where to listen (8080). |
| `SHED_MAX_DEPLOY_MB` | `--max-deploy-mb` | Largest deploy accepted (50). |
| `SHED_CLIENT_IP_HEADER` | `--client-ip-header` | Behind a proxy, the header holding the visitor's IP, such as `fly-client-ip` or `x-real-ip`, for per-visitor limits. Only set it if your proxy overwrites that header. |
| `SHED_ALERT_EMAILS` | `--alert-emails` | Who gets alert emails (server errors, failing sign-in emails, crashes, a filling disk). Defaults to the addresses in `SHED_ADMIN_EMAILS`. Needs `RESEND_API_KEY`. |
| `SHED_ALERT_WEBHOOK` | `--alert-webhook` | A Slack or Discord incoming-webhook URL that also gets alerts. |
| `SHED_METRICS_PORT` | `--metrics-port` | Serve Prometheus metrics at `/metrics` on this port. Keep the port private. |
| `SHED_DEV=1` | `--dev` | Shows sign-in links on screen instead of emailing them. Never use it on a server other people can reach. |

Monitoring, alerts and the admin page are covered in [Operations](operations.md).

## DNS

| Type | Name | Value |
|---|---|---|
| A / CNAME | `shed` | your server or proxy |
| A / CNAME | `*.shed` | the same |

## Backups

Everything is in the data folder. Back up both parts:

```sh
# A consistent copy of the database while Shed runs:
docker exec shed node -e "new (require('node:sqlite').DatabaseSync)('/data/shed.db').exec(\"VACUUM INTO '/data/backup.db'\")"
docker cp shed:/data/backup.db ./shed-$(date +%F).db
# App files never change once deployed, so a plain copy is enough:
docker cp shed:/data/apps ./shed-apps-$(date +%F)
```

To restore, stop Shed, put `shed.db` and `apps/` back in the data folder, and start it again.

## Upgrades

Pull, rebuild and restart. Shed creates any new tables it needs when it starts.

```sh
git pull && docker build -t shed . && docker rm -f shed && docker run ... (same command as above)
```

Take a backup first. Changes are listed in the [commit history](https://github.com/emergentai/shed/commits/main) and on [npm](https://www.npmjs.com/package/shedcloud).

## Security checklist

- Serve only over HTTPS, and set `SHED_BASE_URL` to the `https://` address. Cookies are marked `Secure` automatically.
- Set `SHED_ALLOWED_EMAILS` so only your people can publish.
- Never run with `--dev` where others can reach it.
- Keep backups off the server.
