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

# Docker Compose setup

> Run the full Ansvisor stack on your own server in 10 minutes.

## Stack overview

The repo ships with two services in `docker-compose.yml`:

* **web** — Next.js 16 dashboard, port `3000`
* **server** — Express API + workers, port `80`

Plus an external dependency:

* **Supabase project** — database, auth, storage. You provide URL + keys.

## Prerequisites

* Linux host with Docker 24+ and Docker Compose v2
* Open ports `80` (API) and `3000` (web) — or front them with a reverse proxy
* A Supabase project ([free tier](https://supabase.com/) works fine)
* API keys for at least one AI provider (OpenAI, Anthropic, Google Gemini)

## Steps

**1. Clone the repo**

```bash theme={null}
git clone https://github.com/ansvisor/ansvisor.git
cd ansvisor
```

**2. Apply database migrations**

Either use the Supabase CLI:

```bash theme={null}
cd supabase
supabase link --project-ref YOUR_PROJECT_REF
supabase db push
```

Or paste each `.sql` file in `supabase/migrations/` into the Supabase SQL editor in order.

**3. Configure env files**

```bash theme={null}
cp web/.env.example web/.env
cp server/.env.example server/.env
```

Fill in Supabase URL/keys, AI provider keys, and (optional) DataForSEO + Cloro credentials.
See [Env variables](https://docs.ansvisor.com/self-host/env-variables.md) for the full reference.

**4. Start the stack**

```bash theme={null}
docker compose up -d
docker compose logs -f
```

Web is now on `http://localhost:3000`, API on `http://localhost`.

**5. Create your first user**

Open `http://localhost:3000/sign-up` and register. The first user becomes org admin automatically.

## Production hardening

For a real deployment behind a domain (e.g. `app.example.com` + `api.example.com`):

* Front both services with **Cloudflare** (proxied) or **Caddy/Nginx** for HTTPS
* Use **AWS Security Groups** / firewall rules to restrict origin ports to known IPs
* Set `NEXT_PUBLIC_API_URL=https://api.example.com` and `ALLOWED_ORIGINS=https://app.example.com` accordingly
* Mount logs to a persistent volume or ship to a logging service

> [!TIP]
>
> For solo deploys we recommend **Cloudflare proxied + Flexible SSL** for the API hostname. Zero certificate management, HTTPS works in 2 minutes.

## Updating to a new release

```bash theme={null}
cd ansvisor
git pull
docker compose up -d --build
```

Migrations under `supabase/migrations/` run forward-only — re-running `supabase db push` is idempotent.

## Splitting web and server across hosts

Common setup: web on Vercel, server + workers on a VM.

1. Don't run `docker compose up` for web — deploy `web/` to Vercel directly via Git integration
2. On the VM, run only the server: `docker compose up -d server`
3. In Vercel, set `NEXT_PUBLIC_API_URL=https://api.your-domain.com`
4. In server's env, set `ALLOWED_ORIGINS=https://your-vercel-domain.com`

> [card] [Continue: Supabase setup](https://docs.ansvisor.com/self-host/supabase-setup.md)
>
> Detailed Supabase project preparation (schema, RLS, triggers).


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.