# Local

> Run AI Gateway on your machine for development.

URL: https://boelabs.com/en/docs/ai-gateway/deploy-local
Language: English

For development, run Postgres and Redis in Docker and the gateway on the host with hot reload.

## Dependencies

```bash
git clone https://github.com/boelabs/ai-gateway.git && cd ai-gateway
bun install
docker compose -f docker/compose.yaml -f docker/compose.local.yaml up -d postgres redis
```

This starts only Postgres and Redis locally (plaintext on `localhost`), which the gateway reaches
without TLS — so there is no [Bun TLS issue](https://boelabs.com/docs/ai-gateway/troubleshooting).

## Configure and run

Create `apps/api/.env` (see [Setup](https://boelabs.com/docs/ai-gateway/setup)) with the local connection strings:

```bash
DATABASE_URL=postgres://gateway:gateway@localhost:5432/ai_gateway
REDIS_URL=redis://localhost:6379
```

Apply migrations and start it on Bun with hot reload:

```bash
bun run --filter @boelabs/ai-gateway-api db:migrate
bun run --filter @boelabs/ai-gateway-api dev
curl http://localhost:4000/health/ready
```

`dev` runs the gateway on Bun with `--watch` (restart on change). Next, the
[Quickstart](https://boelabs.com/docs/ai-gateway/quickstart) registers a provider and makes your first call.

## Full stack locally

To run everything (gateway + dashboard + dependencies) in containers instead of on the host:

```bash
docker compose -f docker/compose.yaml -f docker/compose.local.yaml up -d
```

The override binds Postgres, Redis, the gateway, and the dashboard to `127.0.0.1`; it is intentionally not
loaded by production PaaS deployments.

See [Deployment → The Compose stack](https://boelabs.com/docs/ai-gateway/deployment#the-compose-stack).

