---
title: "Hosting and storage"
description: "Choose Docker or Cloudflare and give the portal, widget and API a shared browser-facing gateway."
---

> Documentation Index
> Fetch the complete documentation index at: https://blua.pwp.sh/llms.txt
> Use this file to discover all available pages before exploring further.

# Hosting and storage

## Docker with SQLite

Follow the [quick start](/docs) for the default Compose setup. The SQLite database and private objects live on the `blua-data` volume. Compose binds port 8080 on loopback. For a public service, put a TLS reverse proxy in front and set `PUBLIC_ORIGIN` to the external HTTPS origin.

Configure the proxy to overwrite `X-Real-IP`. Set `TRUSTED_PROXY_IPS` to the exact proxy socket addresses observed by Blua so rate limits apply per reader. Leave it empty for direct connections.

## PostgreSQL

For a new instance, set `POSTGRES_PASSWORD` to a URL-safe random value such as the output of `openssl rand -hex 24`. Select both Compose files in the shell. Use this same pair for provisioning and later maintenance commands.

```sh
export COMPOSE_FILE=compose.yaml:compose.postgres.yaml
docker compose up --build -d
```

PostgreSQL uses a separate database volume. To move an existing installation across backends, follow the [restore procedure](/docs/operations/backups).

## Cloudflare Workers

For local development, use Node 24 and pnpm 12.3.4. From the repository root, install dependencies, migrate the local stores and seed the demo site. Start the API, gateway and jobs process in separate terminals.

```sh
pnpm install --frozen-lockfile
pnpm db:seed:local
```

```sh
pnpm dev:api
```

```sh
pnpm dev:admin:worker
```

```sh
pnpm --filter @blua/jobs-worker dev
```

The local gateway listens at `http://127.0.0.1:5173` and the API at `http://127.0.0.1:8787`. The seeded site key is `pk_demo`. Point the API and jobs process at the same stores.

For a remote deployment, provision control and data D1 databases, a private R2 content bucket, a queue and dead-letter queue, and the gateway’s API Service Binding. Use environment-specific configuration with real resource IDs. Apply migrations to both databases before routing traffic. Use `pnpm account:provision` to generate the owner SQL, apply it to the control database and set `ADMIN_USER_ID` to the generated account ID. The command takes `ACCOUNT_EMAIL`, `ACCOUNT_PASSWORD` and a new private output file path in `ACCOUNT_SQL`.

Configure `PUBLIC_ORIGIN`, `CURSOR_SECRET`, `BETTER_AUTH_SECRET` and the Turnstile credentials used by the deployment. Serve `/account`, `/api/auth`, `/v1` and `/embed.js` from the same gateway origin.

## Private objects

Both Docker SQL backends can store objects in R2. Set `R2_ENDPOINT`, `R2_BUCKET`, `R2_ACCESS_KEY_ID` and `R2_SECRET_ACCESS_KEY` together. To switch an existing object store, pause writes and delivery, copy the entire store including `erased/`, verify counts and bytes, then switch the configuration.

Source: https://blua.pwp.sh/docs/en/operations/hosting/
