Skip to main content
This guide covers all configuration options for your self-hosted Bilanc deployment, including environment variables, database setup, and tenant configuration.

Initial Setup

  1. Create your environment file:
    cp .env.example .env
    
  2. Edit .env with your configuration values as described below.
  3. Configure your tenant in tenant_config.yaml.

Environment Variables

Database Configuration

Bilanc requires a PostgreSQL database. Configure the connection details:
VariableDescriptionDefaultExample
POSTGRES_HOSTHostname or IP of the PostgreSQL serverdbdb.example.com
POSTGRES_PORTPort number54325432
POSTGRES_DATABASEDatabase namebilancbilanc_prod
POSTGRES_USERNAMEDatabase userbilancbilanc_user
POSTGRES_PASSWORDDatabase password-secure_password
RAW_DATA_SCHEMASchema for raw data storagebilancbilanc
# Database Configuration
POSTGRES_HOST=your_postgres_host
POSTGRES_PORT=5432
POSTGRES_DATABASE=bilanc_db
POSTGRES_USERNAME=your_username
POSTGRES_PASSWORD=your_secure_password
RAW_DATA_SCHEMA=bilanc

AI Provider Configuration

Bilanc uses AI for generating insights. Choose one provider and configure its API key:
VariableDescriptionExample
AI_PROVIDERAI backend: openai, anthropic, or google-aiopenai
AI_MODELSpecific model to usegpt-4o
OPENAI_API_KEYAPI key for OpenAI (if AI_PROVIDER=openai)sk-...
ANTHROPIC_API_KEYAPI key for Anthropic (if AI_PROVIDER=anthropic)sk-ant-...
GOOGLE_API_KEYAPI key for Google AI (if AI_PROVIDER=google-ai)AIza...
Only set the API key corresponding to your chosen AI_PROVIDER.
# AI Configuration
AI_PROVIDER=openai
AI_MODEL=gpt-4o
OPENAI_API_KEY=sk-...

Integration Tokens

Configure tokens for the data sources you want to connect:
VariableDescriptionExample
GITHUB_ACCESS_TOKENGitHub Personal Access Token with repo and read:org scopesghp_...
GITHUB_REPOSITORYSpace-separated list of repositories (owner/name format)org/repo-1 org/repo-2
LINEAR_ACCESS_TOKENLinear API tokenlin_api_...
CURSOR_API_KEYCursor API keycursor_...
# Integration Tokens
GITHUB_ACCESS_TOKEN=ghp_abcdef1234567890
GITHUB_REPOSITORY=bilanc/frontend bilanc/backend bilanc/api
LINEAR_ACCESS_TOKEN=lin_api_xxxxx
CURSOR_API_KEY=cursor_xxxxx
See Integrations for detailed setup instructions for each integration.

Application Settings

Configure the frontend and application behavior:
VariableDescriptionExample
FRONTEND_URLPublic URL of your Bilanc dashboardhttps://dashboard.yourdomain.com
NEXT_PUBLIC_API_URLAPI URL for the frontendhttp://host.docker.internal:8000
NEXT_PUBLIC_AUTH_URLAuthentication provider URLhttps://auth.yourdomain.com
NEXT_PUBLIC_AUTH_API_KEYAuthentication API keyyour_auth_api_key
ENVIRONMENTEnvironment namedev or production
# Application Settings
FRONTEND_URL=https://dashboard.yourdomain.com
NEXT_PUBLIC_API_URL=http://host.docker.internal:8000
NEXT_PUBLIC_AUTH_URL=https://auth.yourdomain.com
NEXT_PUBLIC_AUTH_API_KEY=your_auth_api_key
ENVIRONMENT=production

Email Configuration

Bilanc uses Resend for sending emails:
VariableDescriptionExample
RESEND_API_KEYAPI key for Resendre_...
DEFAULT_SENDER_EMAILFrom address for system emailsnotifications@yourdomain.com
# Email Configuration
RESEND_API_KEY=re_1234567890abcdef
DEFAULT_SENDER_EMAIL=notifications@yourdomain.com

Internal Settings

These are typically left at their default values:
VariableDescriptionDefault
DBT_PREFIXPrefix for dbt modelsmarts
CELERY_BROKER_URLRedis URL for Celeryredis://broker:6379/0
# Internal Settings
DBT_PREFIX=marts
CELERY_BROKER_URL=redis://broker:6379/0

Complete .env Example

# ─── Database Configuration ───────────────────────────────────────────────
POSTGRES_HOST=db
POSTGRES_PORT=5432
POSTGRES_DATABASE=bilanc
POSTGRES_USERNAME=bilanc
POSTGRES_PASSWORD=secure_password
RAW_DATA_SCHEMA=bilanc

# ─── AI Configuration ─────────────────────────────────────────────────────
AI_PROVIDER=openai
AI_MODEL=gpt-4o
OPENAI_API_KEY=sk-...

# ─── Integration Tokens ───────────────────────────────────────────────────
GITHUB_ACCESS_TOKEN=ghp_abcdef1234567890
GITHUB_REPOSITORY=bilanc/frontend bilanc/backend
LINEAR_ACCESS_TOKEN=lin_api_xxxxx
CURSOR_API_KEY=cursor_xxxxx

# ─── Application Settings ─────────────────────────────────────────────────
FRONTEND_URL=https://dashboard.yourdomain.com
NEXT_PUBLIC_API_URL=http://host.docker.internal:8000
NEXT_PUBLIC_AUTH_URL=https://auth.yourdomain.com
NEXT_PUBLIC_AUTH_API_KEY=your_auth_api_key
ENVIRONMENT=production

# ─── Email Configuration ──────────────────────────────────────────────────
RESEND_API_KEY=re_1234567890abcdef
DEFAULT_SENDER_EMAIL=notifications@yourdomain.com

# ─── Internal Settings ────────────────────────────────────────────────────
DBT_PREFIX=marts
CELERY_BROKER_URL=redis://broker:6379/0

Target Configuration

The target_config.yaml file configures database connections for data transformation:
postgres:
  postgres_db:
    username: !ENV ${POSTGRES_USERNAME}
    password: !ENV ${POSTGRES_PASSWORD}
    hostname: !ENV ${POSTGRES_HOST}
    db_name:  !ENV ${POSTGRES_DATABASE}
    schema:   !ENV ${RAW_DATA_SCHEMA}
    port:     !ENV ${POSTGRES_PORT}
This configuration uses environment variables from your .env file for consistency.

Tenant Configuration

The tenant_config.yaml file defines your organization and data source connections (called “taps”).

Basic Structure

tenants:
  - name: Your Organization Name
    domain: yourdomain.com
    is_auto_onboarding_enabled: true
    taps:
      # Data source configurations go here
FieldDescription
nameYour organization’s display name
domainYour organization’s email domain (used for auto-onboarding)
is_auto_onboarding_enabledAutomatically onboard users with matching email domain
tapsList of data source integrations

Tap Configuration

Each tap represents a data source integration:
taps:
  - name: github
    type: tap-github
    config:
      start_date: 2025-01-01
      repository: !ENV ${GITHUB_REPOSITORY}
  
  - name: linear
    type: tap-linear
    config:
      start_date: 2025-01-01
  
  - name: cursor
    type: tap-cursor
    config:
      start_date: 2025-01-01
FieldDescription
nameIdentifier for this tap instance
typeTap type: tap-github, tap-linear, or tap-cursor
config.start_dateDate to start collecting data from (YYYY-MM-DD)
config.repository(GitHub only) Repository list from environment variable

Complete Tenant Configuration Example

tenants:
  - name: Acme Corporation
    domain: acme.com
    is_auto_onboarding_enabled: true
    taps:
      - name: github
        type: tap-github
        config:
          start_date: 2025-01-01
          repository: !ENV ${GITHUB_REPOSITORY}
      - name: linear
        type: tap-linear
        config:
          start_date: 2025-01-01
      - name: cursor
        type: tap-cursor
        config:
          start_date: 2025-01-01
The start_date determines how far back Bilanc will fetch historical data. Setting an earlier date will result in more data but longer initial sync times.

Next Steps