# bhatti

Prepare the HTTPS API URL and API key that let Sandcovery run sandboxes on your own bhatti server.

bhatti is open-source software that runs sandboxes on your own Linux or Apple Silicon machine, so Sandcovery reaches your server over the internet. A fresh install answers only on a local Unix socket, so first set up domain mode, which serves the API over TLS on port 443, as bhatti's [self-hosting guide](https://bhatti.sh/docs/self-hosting/) describes.

- **HTTPS API URL**: your server's API address in domain mode, such as `https://api.yourdomain.com`. Sandcovery takes only an `https://` address with no port or path, and never a plaintext `listen` address, which bhatti says must not face an untrusted network.
- **API key**: the `bht_` key of a bhatti user that only Sandcovery uses. On the server, run `sudo bhatti user create --name sandcovery`, which allows 5 sandboxes at once of up to 4 vCPUs and 4096 MB each. Add `--max-sandboxes`, `--max-cpus`, or `--max-memory` to allow more. bhatti refuses a larger sandbox, and Sandcovery then tries your next provider.

Each sandbox runs as the user `lohar` in `/home/lohar`. Egress `allow_all` reaches the public internet only, `deny_all` starts the sandbox with no network interface, and an allowlist takes host names and CIDR blocks. A preview URL needs a proxy zone in domain mode, which publishes each port at `https://<alias>.<proxy zone>`.

bhatti charges nothing, so Sandcovery prices its sandboxes at $0. The cost of the machine it runs on is yours. A bhatti credential points at your own server, so it never counts toward the [free vCPUh](/docs/billing#one-free-month-of-vcpuh).
