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

# Docker Setup

> Run the entire Instance stack (Web, API, Workers, PostgreSQL, and Redis) in minutes using Docker Compose.

Docker Compose lets you start the full Instance platform without installing PostgreSQL, Redis, or Node dependencies on your host machine.

***

## Prerequisites

* **Docker Desktop** (or Docker Engine + Docker Compose v2)
* **Git**

***

## Step-by-Step Launch

1. **Clone the repository and create `.env`**:

```bash theme={null}
git clone https://github.com/sumamakhan761/tryinstance.git
cd instance
cp .env.example .env
```

2. **Configure required environment variables** in `.env`:

* Set `NEXTAUTH_SECRET` to a random 32-byte hex string (`openssl rand -hex 32`).
* Set `INSTAGRAM_APP_ID`, `INSTAGRAM_APP_SECRET`, `INSTAGRAM_REDIRECT_URI`, and `META_WEBHOOK_VERIFY_TOKEN` for Instagram connectivity.
* Optionally customize `POSTGRES_USER`, `POSTGRES_PASSWORD`, and `POSTGRES_DB` (defaults are pre-configured in `docker-compose.yml`).

3. **Start the container stack**:

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

4. **Verify all containers are healthy**:

```bash theme={null}
docker compose ps
```

***

## Container Stack Overview

| Service | Port | Role |
| :- | :- | :- |
| **`web`** | `3000` | Next.js 16 dashboard and public Bio Link pages (`/l/[slug]`) |
| **`api`** | `4000` | NestJS 11 REST API, `/api/v1/*`, and Meta webhook endpoint |
| **`workers`** | Internal | BullMQ workers for DMs, comment replies, profile sync, and scheduled posts |
| **`postgres`** | `5432` | PostgreSQL 16 database |
| **`redis`** | `6379` | Redis 7 for BullMQ queues, rate limits, and webhook deduplication |
| **`db-migrate`** | One-shot | Automatically runs Prisma migrations on startup before `api` and `workers` boot |

***

## Data Volumes and Persistence

PostgreSQL and Redis store data in named Docker volumes (`postgres_data` and `redis_data`).

* To stop containers while keeping your database intact:

```bash theme={null}
docker compose down
```

* **Warning**: Never run `docker compose down -v` in production, as `-v` deletes your persistent database and Redis volumes.

***

## Helpful Docker Commands

```bash theme={null}
# View live logs across all services
docker compose logs -f

# View logs for a specific service (e.g., api or workers)
docker compose logs -f api workers

# Rebuild and restart after pulling code updates
docker compose up -d --build

# Run a Prisma push manually inside the api container
docker compose exec api pnpm db:push
```

***

## Next Step

Once `http://localhost:3000` is running, follow [Instagram Setup](/docs/instagram-setup.md) to connect your Instagram Business or Creator account.


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