Edge Server can host multiple Ditto applications in a single instance, allowing you to manage different data namespaces and sync configurations from one server.

Use Cases

  • Multi-tenant deployments: Isolate data for different customers or departments
  • Development environments: Run staging and production apps side-by-side
  • Migration scenarios: Transition between app versions gradually
  • Data isolation: Keep different data types completely separated

Configuration

Define multiple database resources in your configuration file, each with its own db_id and authentication settings. Each app can have its own subscriptions, HTTP servers, and transport configurations:
resources:
  # First app
  app1_db:
    resource_type: DittoDatabase
    db_id: "APP_ID_1"
    device_name: "edge-server-app1"
    subscriptions:
      - "SELECT * FROM collection1"
    auth:
      small_peers_only:
        offline_license_token: "TOKEN_1"
  
  # Second app
  app2_db:
    resource_type: DittoDatabase
    db_id: "APP_ID_2"
    device_name: "edge-server-app2"
    subscriptions:
      - "SELECT * FROM collection2"
    auth:
      server:
        access_token: "TOKEN_2"
        auth_url: "https://auth-url-2.cloud.dittolive.app"
        provider: "__playgroundProvider"
  
  # HTTP servers for each app
  app1_http:
    resource_type: HttpServer
    db_id: "APP_ID_1"
    base_path: app1
    http_api: true
    listen_addr: "0.0.0.0:8081"
  
  app2_http:
    resource_type: HttpServer
    db_id: "APP_ID_2"
    base_path: app2
    http_api: true
    listen_addr: "0.0.0.0:8082"

Key Considerations

Separate Persistence

By default, each app will use its own persistence directory to avoid data conflicts:
  • app1/ditto_APP_ID_1
  • app2/ditto_APP_ID_2

Different Ports

If exposing HTTP APIs, you must use different ports for each app. In the future this will be consolidated into one HTTP server while respecting the defined namespaces.
  • app1 → port 8081
  • app2 → port 8082

Independent Auth

Each app can have its own authentication configuration:
  • Small peers only mode
  • Cloud sync with different credentials