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

# Deploy a Self-Hosted sovseal Instance in 5 Minutes

> Four commands: link a Supabase project, push the schema, deploy the edge function, point your SDK at it.

Self-hosting sovseal means running the `v2-agent-state` replication function on your own Supabase project. There is no Docker stack, no separate dashboard server, and no setup wizard — it is one Deno edge function backed by Postgres, and deploying it is four commands.

<Note>
  Local capture and recall (`store_memory` / `recall_memory`) never touch this function at all — they run entirely on-device. Self-hosting only matters if you also want to **replicate** state across devices without using the managed Platform.
</Note>

## Prerequisites

* **Supabase CLI** (`brew install supabase/tap/supabase` on Mac)
* A Supabase project (free tier is enough to try this)

## Deploy

```bash theme={null}
# 1. Link your project
supabase login
supabase link --project-ref your-project-ref

# 2. Apply the schema
supabase db push

# 3. Deploy the function
supabase functions deploy v2-agent-state --project-ref your-project-ref
```

Supabase provisions `SUPABASE_URL` and `SUPABASE_SERVICE_ROLE_KEY` automatically — these are the only two secrets the function needs, and you never set them by hand.

## Point the SDK at it

```typescript theme={null}
import { AgentStateClient } from "@sovseal/sdk";

const client = new AgentStateClient({
  endpoint: "https://your-project-ref.supabase.co/functions/v1/v2-agent-state",
  apiKey: "your-api-key",
});
```

## Verify it

```typescript theme={null}
const lineageHistory = await client.lineage({ agentId: "my-agent-id-hash" });
console.log("Self-hosted connection status: OK", lineageHistory);
```

An empty array back is success — it means the function is reachable and authenticating correctly; there is simply no history for that agent yet.

For the full walkthrough including Row-Level Security details, see [Deploy Self-Hosted](/self-hosted/deploy). For every environment variable the SDK reads, see [Configuration](/self-hosted/configuration).
