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

# Self-Hosting / Setup

> Run ClawMind locally or deploy it with 0G Compute, 0G Storage, 0G Chain, and Redis-backed task polling.

# Self-Hosting / Setup

ClawMind is a Next.js app. To run the full production path, you need:

| Requirement       | Purpose                                                   |
| ----------------- | --------------------------------------------------------- |
| 0G Router API key | LLM agent inference through 0G Compute.                   |
| Funded 0G wallet  | 0G Storage uploads and registry transactions.             |
| Registry address  | Where analysis hashes are anchored on-chain.              |
| Redis URL         | Keeps async task status available while the client polls. |

***

## Local Setup

```bash theme={null}
git clone https://github.com/ILYUTKICK/clawmind.git
cd clawmind
npm install
cp .env.example .env
npm run dev
```

Open `http://localhost:3000`.

The app can boot with placeholder env values, but real 0G Storage and Chain writes require the production variables below.

***

## Required Production Env

```bash theme={null}
ZERO_G_NETWORK=mainnet
ZERO_G_COMPUTE_ENDPOINT=https://router-api.0g.ai/v1/chat/completions
ZERO_G_COMPUTE_API_KEY=your_0g_mainnet_router_api_key
ZERO_G_COMPUTE_MODEL=deepseek/deepseek-chat-v3-0324

ZERO_G_STORAGE_ENABLED=true
ZERO_G_STORAGE_PRIVATE_KEY=your_mainnet_wallet_private_key

ZERO_G_ANALYSIS_REGISTRY_ADDRESS=0x24bAAC6720ae5B01A1CC90eCC1C15AFcb903E121
ZERO_G_ALLOW_LEGACY_REGISTRY_WRITES=false
CLAWMIND_ANALYZE_RATE_LIMIT_SECONDS=60

KV_REDIS_URL=your_redis_url
DEBUG_API_TOKEN=your_debug_token
```

<Warning>
  Never commit `ZERO_G_STORAGE_PRIVATE_KEY`. Use a dedicated wallet with only the funds needed for storage uploads and gas.
</Warning>

***

## Deploy

On Vercel or another Next.js host:

1. Add the env vars above.
2. Build with `npm run build`.
3. Start with `npm run start`.
4. Run the checks below.

```bash theme={null}
npm run build
npm run start
```

`/api/analyze` starts a background analysis and the client polls `/api/status?taskId=...`. Redis is strongly recommended in production so task status does not disappear between serverless invocations.

***

## Verify Your Deployment

```bash theme={null}
curl https://YOUR_DOMAIN/api/status
curl https://YOUR_DOMAIN/api/judge
curl https://YOUR_DOMAIN/api/verify
```

Expected:

| Check                | Expected          |
| -------------------- | ----------------- |
| Compute provider     | `0G_COMPUTE`      |
| Storage provider     | `0G_STORAGE`      |
| On-chain configured  | `true`            |
| Latest registry mode | `SIGNED_OPERATOR` |
| Signature verified   | `true`            |

For configuration debugging:

```bash theme={null}
curl https://YOUR_DOMAIN/api/debug \
  -H "Authorization: Bearer YOUR_DEBUG_API_TOKEN"
```

***

## Optional: Deploy Your Own Registry

The hosted app uses:

```text theme={null}
0x24bAAC6720ae5B01A1CC90eCC1C15AFcb903E121
```

To deploy your own signed registry:

```bash theme={null}
git submodule update --init --recursive
set -a
source .env
set +a
node scripts/deploy-registry.mjs
```

Then set:

```bash theme={null}
ZERO_G_ANALYSIS_REGISTRY_ADDRESS=your_deployed_contract
ZERO_G_ALLOW_LEGACY_REGISTRY_WRITES=false
```

The deployer wallet becomes the first authorized EIP-712 operator.

***

## Optional: Docker

```bash theme={null}
docker build -t clawmind .
docker run --env-file .env -p 3000:3000 clawmind
```

Then open `http://localhost:3000`.

***

## Optional: MCP Server

The MCP server lives in `apps/mcp-server`.

```bash theme={null}
cd apps/mcp-server
npm install
npm run build
npm run start
```

Set `CLAWMIND_API_BASE_URL` if the MCP server should call your self-hosted app instead of the public deployment.
