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

# Database Options

> Configure SQLite or PostgreSQL database for Pangolin

<div id="pangolin-toc-cta" className="pangolin-toc-cta-source">
  <Card title="Try free on Pangolin Cloud" icon="cloud" href="https://app.pangolin.net/auth/signup" arrow="true" cta="Sign up free">
    Fastest way to get started with Pangolin using the hosted control plane. No credit card required.
  </Card>
</div>

Pangolin supports two database options: SQLite for simplicity and PostgreSQL for production deployments.

<CardGroup cols={2}>
  <Card title="SQLite (Default)" icon="database">
    * No configuration required
    * Easy to use and portable
    * Built into the main image
    * Perfect for development
  </Card>

  <Card title="PostgreSQL" icon="database">
    * Production-ready database
    * Better performance at scale
    * Requires separate image
    * Advanced configuration options
  </Card>
</CardGroup>

## SQLite

By default, Pangolin uses SQLite for its ease of use and portability.

**Docker Image**: `fosrl/pangolin:<version>`

<Note>
  No configuration is required to use SQLite with Pangolin.
</Note>

## PostgreSQL

You can optionally use PostgreSQL for production deployments.

**Docker Image**: `fosrl/pangolin:postgresql-<version>`

### Configuration

Add the following section to your Pangolin configuration file:

```yaml title="config.yml" theme={"dark"}
postgres:
  connection_string: postgresql://<user>:<password>@<host>:<port>/<database>
```

<Warning>
  Replace the placeholders with your actual PostgreSQL connection details.
</Warning>

### Docker Compose Example

This example sets up PostgreSQL with health checks to ensure the database is ready before Pangolin starts:

```yaml title="docker-compose.yml" theme={"dark"}
name: pangolin
services:
  pangolin:
    image: fosrl/pangolin:postgresql-latest # Don't use latest in production
    container_name: pangolin
    restart: unless-stopped
    depends_on:
      postgres:
        condition: service_healthy
    volumes:
      - ./config:/app/config
    healthcheck:
      test: ["CMD", "curl", "-f", "http://localhost:3001/api/v1/"]
      interval: "10s"
      timeout: "10s"
      retries: 15

  # ... other services ...

  postgres:
    image: postgres:17
    container_name: postgres
    restart: unless-stopped
    environment:
      POSTGRES_USER: postgres
      POSTGRES_PASSWORD: postgres
    volumes:
      - ./config/postgres:/var/lib/postgresql/data
    healthcheck:
      test: ["CMD-SHELL", "pg_isready -U postgres"]
      interval: 10s
      timeout: 5s
      retries: 5
```

<Warning>
  This example is not necessarily production-ready. Adjust the configuration according to your needs and security requirements.
</Warning>

<Note>
  Do not use `latest` tags in production. Use specific version tags for stability.
</Note>
