The DittoDatabase resource is the fundamental building block of Edge Server deployments. It
manages a single Ditto database instance that can synchronize data across devices using
peer-to-peer protocols and optionally sync with Ditto Cloud or self-hosted servers.
Basic Configuration
Required Fields
Authentication Methods
The auth field determines how the database connects to the mesh. You must choose one of two authentication methods:
Cloud/Server Authentication
Connect to Ditto Cloud or a self-hosted Ditto server for centralized authentication and optional cloud sync:
Ditto SDK Devices (Small Peer Only) Mode
For offline mesh networks without cloud connectivity:
Optional Configuration
Auto-Fetch Attachments
Control whether the database automatically fetches new attachments from other peers:
Automatically fetching attachments will incur a performance cost in both network and disk usage. Only enable this if your application requires immediate attachment synchronization.
Subscriptions
Define DQL subscriptions to register with this database:
Subscriptions can be:
- Simple strings: Direct DQL queries without parameters
- Objects with arguments: DQL queries with named parameters using the
:param syntax
Persistence Directory
Control where the database stores its files:
Options:
"from_current_exe" - Store in directory adjacent to Edge Server executable (default)
"temp_dir" - Use temporary directory (useful for testing)
{ path: "path/to/dir" } - Specify a custom path (relative to config file or absolute)
{ from_env: "ENV_VAR_NAME" } - Read path from environment variable
Transport Configuration
Fine-tune how the database communicates with other peers:
Peer-to-Peer Settings
Connect Configuration
Configure outbound connections to known servers:
Listen Configuration
Configure inbound TCP connections:
Important Notes
- Device Name: The
device_name helps identify this Edge Server instance in the mesh network. Choose descriptive names for easier debugging
- Transport Defaults: When transport settings are
null, Edge Server uses sensible defaults based on your platform and network environment
- Security: In production, always use proper authentication providers configured in the Ditto Portal rather than playground mode