Package: dodo-sync on npm | Source: GitHub
What Can You Sync?
Choose any combination of these entities:Payments
All payment transactions, including one-time payments, refunds, and status updates.
Customers
Customer profiles, contact information, and metadata.
Subscriptions
Subscription data, billing cycles, and status changes.
Licenses
License keys, activations, and status updates.
scopes parameter. Each run fetches every record in the selected scopes and writes it by ID, so existing rows are updated in place instead of duplicated. In MongoDB, license keys are stored by subscription ID, so a subscription with several license keys keeps only one of them.
Database Support
Dodo Sync supports MongoDB, PostgreSQL, MySQL, and ClickHouse. Support for Snowflake and other databases, ETL pipelines, and realtime sync is in development. To contribute a new database integration, submit a pull request to the GitHub repository.Getting Started
Use Dodo Sync via the CLI for quick setup or programmatically in your code for integration into your application. Both methods provide the same functionality.Using the CLI
Install the CLI globally to run it from anywhere:Running the CLI
The CLI supports two modes: interactive for guided setup, and manual for direct configuration. Interactive mode: Run without arguments to start the setup wizard.CLI Arguments
number
required
Sync interval in seconds. The CLI runs continuously at this interval. For a one-time sync, use
.run() in your code.string
required
Database type:
"mongodb", "postgres", "mysql", or "clickhouse".string
required
Connection URI for your database:
- MongoDB:
mongodb://localhost:27017ormongodb+srv://user:pass@cluster.mongodb.net/ - PostgreSQL:
postgresql://user:password@localhost:5432/mydb - MySQL:
mysql://user:password@localhost:3306/mydb - ClickHouse:
http://localhost:8123
string
required
Comma-separated list of entities to sync:
licences, payments, customers, subscriptions. Example: "payments,customers".string
required
Your Dodo Payments API key from Developer → API Keys. Use a key from the same mode as
--env.string
required
Environment:
"live_mode" or "test_mode".number
Rate limit in requests per second. Controls how fast the sync engine makes API requests. Defaults to
10; values of 100 or more turn off throttling.Using in Your Code
Integrate the sync feature directly into your application. Install it as a dependency:Automatic Sync (Interval-based)
Run the sync continuously at regular intervals:Manual Sync
Trigger sync operations on-demand, such as from a cron job or API endpoint:PostgreSQL Example
MySQL Example
ClickHouse Example
Constructor Options
string
required
Database type:
"mongodb", "postgres", "mysql", or "clickhouse".string
required
Connection string for your database:
- MongoDB:
mongodb://localhost:27017ormongodb+srv://... - PostgreSQL:
postgresql://user:password@localhost:5432/mydb - MySQL:
mysql://user:password@localhost:3306/mydb - ClickHouse:
http://localhost:8123
string[]
required
Array of entities to sync:
"licences", "payments", "customers", "subscriptions". Include any combination.object
required
Dodo Payments API configuration. See the TypeScript SDK types for complete options.Required properties:
bearerToken: Your Dodo Payments API keyenvironment:"test_mode"or"live_mode"
number
Time in seconds between automatic syncs. Required for
.start(), optional for .run().number
Rate limit in requests per second. Defaults to
10; values of 100 or more turn off throttling.Important Information
Additional Resources
GitHub Repository
View source code, report issues, or contribute improvements
npm Package
View package details and installation instructions