---
title: "Self-hosting"
description: "Run maruhi on your own Cloudflare account with a single cf deploy."
image: "https://maruhi.app/og.png"
---

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

# Self-hosting

maruhi is designed to be self-hosted: one Cloudflare Worker, one D1 database, and Durable Objects, deployed with the plain `cf` CLI from a clone of the repository. There is no separate build artifact and no telemetry.

```sh
git clone https://github.com/maruhiapp/maruhi.git
cd maruhi
bun install
cd apps/server
bunx cf auth login
```

From there the full guide walks through creating the D1 database, the first deploy, registering a GitHub OAuth App, and connecting the CLI:

- **Self-hosting guide** — `docs/SELF_HOSTING.md` in the repository — prerequisites, the seven setup steps, sign-up policy,
  quotas, backups, and operations.

## What you get

- The same server, dashboard, and CLI as the hosted service. The server code is [FSL-1.1-MIT](https://github.com/maruhiapp/maruhi/blob/main/LICENSE.md) licensed; the CLI and crypto packages are MIT.
- End-to-end encryption by default. Your deployment never sees plaintext values either.
- Optional operations tooling: periodic D1 exports, project snapshots to R2, and trip-wire alerts.

## Moving a project in or out

No lock-in is a mechanism, not a promise: a project's owner can take the whole project — the signed membership chain, every ciphertext and its history, the wrapped keys, the statements, and the audit log — out of any maruhi deployment with one command, and the operator of another deployment imports it over the same restore path that handles backups:

```sh
maruhi project export --server https://my.maruhi.app --project <project-id> --out acme.ndjson.gz
```

The export is the server's own content (nothing is decrypted — your deployment never sees a plaintext either), plus a small companion file naming the members' GitHub identities so that, after the import, each member's first login on the new server lands on the user id the chain already names. The import, the identity rules, and what has to be redone afterwards (the server-key grant, recovery setup, tokens) are in the guide's [Migrating a project](https://github.com/maruhiapp/maruhi/blob/main/docs/SELF_HOSTING.md#migrating-a-project-from-another-maruhi-export--import) section.

## A mirror in your own account

Read availability does not depend on one deployment being up: a project's owner can keep a **mirror** — a second deployment, yours, holding a verified read-only replica — and members fall back to it when the primary does not answer:

```sh
maruhi mirror mark --server https://mirror.example.com --project <project-id> --source https://my.maruhi.app
maruhi mirror sync --server https://my.maruhi.app --mirror https://mirror.example.com --project <project-id>
maruhi config set mirror https://mirror.example.com
```

The mirror accepts a replica only when it extends what it already holds, refuses every write, serves CI leases under its own server key once granted (`maruhi server grant --key-from`), and can be promoted with `maruhi mirror promote` if the primary is gone for good. The bootstrap, the cron, the fallback rules and the limits are in the guide's [Running a mirror](https://github.com/maruhiapp/maruhi/blob/main/docs/SELF_HOSTING.md#running-a-mirror-a-read-replica-for-when-the-primary-is-down) section.

Source: https://maruhi.app/docs/self-hosting/index.mdx
