# Quick Start

Get a self-hosted BuildBase server running in 30 seconds with Docker Compose.

## Quick Start

This guide gets you from zero to a running server in under a minute. Everything is bundled in one file — MongoDB, Redis, and the app server. No external services needed.

### Prerequisites

- [Docker](https://docs.docker.com/get-started/get-docker/) and Docker Compose installed
- A BuildBase account with a self-hosted organization ([create one here](https://console.buildbase.app))

### Step 1: Get Your Credentials

When you create a self-hosted organization in the dashboard, you'll see a setup wizard with your credentials:

- **Organization ID** — identifies your org on the central server
- **Central Server URL** — where your server reports to
- **Signing Key ID** — ES256 key for secure token exchange

These are pre-filled in the docker-compose template the wizard generates.

### Step 2: Create docker-compose.yml

Save this file. Replace `YOUR_ORG_ID` and `YOUR_CENTRAL_SERVER_URL` with the values from the setup wizard.

```yaml
# All-in-one: MongoDB + Redis + App
# Save as docker-compose.yml and run: docker compose up -d

services:
  mongodb:
    image: mongo:7
    volumes:
      - mongo_data:/data/db
    restart: unless-stopped
    healthcheck:
      test: ["CMD", "mongosh", "--eval", "db.adminCommand('ping')"]
      interval: 10s
      timeout: 5s
      retries: 5

  redis:
    image: redis:7-alpine
    command: redis-server --appendonly yes --maxmemory 256mb
    volumes:
      - redis_data:/data
    restart: unless-stopped
    healthcheck:
      test: ["CMD", "redis-cli", "ping"]
      interval: 10s
      timeout: 5s
      retries: 5

  app:
    image: buildbaseapp/tenant-server:latest
    platform: linux/amd64
    ports:
      - "3000:3000"
    environment:
      - NODE_ENV=production
      - PORT=3000
      - MONGO_CONNECTION_URL=mongodb://mongodb:27017/tenant
      - REDIS_HOST=redis
      - REDIS_PORT=6379
      - CENTRAL_SERVER_URL=YOUR_CENTRAL_SERVER_URL
      - ORG_IDS=YOUR_ORG_ID
      - SERVER_URL=http://localhost:3000
      - APPLICATION_URL=http://localhost:4100
      - JWT_PASS=dev-secret-change-in-production-1
      - DB_ENCRYPTION_KEY=dev-secret-change-in-production-2
      - SECRET_KEY=dev-secret-change-in-production-3
      - OAUTH2_SECRET=dev-secret-change-in-production-4
      - INTERNAL_API_KEY=dev-secret-change-in-production-5
      - CORS_WHITELISTED_DOMAINS=YOUR_CENTRAL_SERVER_URL,http://localhost:4100
    depends_on:
      mongodb:
        condition: service_healthy
      redis:
        condition: service_healthy
    restart: unless-stopped
    healthcheck:
      test: ["CMD", "wget", "-qO-", "http://127.0.0.1:3000/api/ready"]
      interval: 15s
      timeout: 5s
      start_period: 30s
      retries: 3

volumes:
  mongo_data:
  redis_data:
```

### Step 3: Run It

```bash
docker compose up -d
```

Docker will pull the image and start all three containers. The server will be available at `http://localhost:3000` in about 30 seconds.

### Step 4: Verify

```bash
# Check all containers are up
docker compose ps

# Should return {"ready": true}
curl http://localhost:3000/api/ready
```

### Step 5: Connect

Go back to the setup wizard in the dashboard, enter your server URL (`http://localhost:3000` for local testing), click **Test connection**, then **Complete setup**.

## What's Next

- [Production deployment](/self-hosted/production) — Nginx, SSL, replicas, external MongoDB
- [Configuration reference](/self-hosted/configuration) — all environment variables
