
Security News
/Company News
Socket Is Sponsoring Composer and Packagist
Socket has joined the new Composer and Packagist sponsorship program as a launch sponsor, supporting the team that keeps PHP's package ecosystem secure.
d1-sync-local
Advanced tools
Sync Cloudflare D1 remote databases to your local development environment with ease.
wrangler.toml to find all D1 databasesnpm install -g d1-sync-local
Or use directly with npx:
npx d1-sync-local
Navigate to your Cloudflare Workers project directory (where wrangler.toml is located) and run:
d1-sync-local
Or use the shorter alias:
d1sl
The tool will:
wrangler.toml configurationnpm install -g wrangler)wrangler d1 export to get remote database data$ d1-sync-local
🚀 D1 Sync to Local
✓ Found wrangler.toml
Local database: my-app-db
? Select source database to sync from:
❯ Local/Default (my-app-db)
Staging (my-app-db-staging)
Production (my-app-db-production)
⚠️ This will sync my-app-db-staging to local database
? All local data will be replaced. Continue? (y/N)
✓ Export completed
✓ Cleaned local database (3 files)
✓ Export file processed
✓ Import completed
📊 Synced 6 tables:
✓ users: 150 records
✓ products: 89 records
✓ orders: 1203 records
✓ categories: 12 records
✓ sessions: 567 records
✓ logs: 4521 records
✨ Sync completed successfully!
The tool reads your wrangler.toml file to find D1 databases:
# Default/Local database
[[d1_databases]]
binding = "DB"
database_name = "my-app-db"
database_id = "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx"
# Environment-specific databases
[env.staging]
[[env.staging.d1_databases]]
binding = "DB"
database_name = "my-app-db-staging"
database_id = "yyyyyyyy-yyyy-yyyy-yyyy-yyyyyyyyyyyy"
[env.production]
[[env.production.d1_databases]]
binding = "DB"
database_name = "my-app-db-production"
database_id = "zzzzzzzz-zzzz-zzzz-zzzz-zzzzzzzzzzzz"
The tool automatically detects your system language and displays messages in:
You can override the auto-detected language using the D1_SYNC_LANG environment variable:
# Use Simplified Chinese
D1_SYNC_LANG=zh-cn d1-sync-local
# Use Traditional Chinese
D1_SYNC_LANG=zh-tw d1-sync-local
# Use Japanese
D1_SYNC_LANG=ja d1-sync-local
# Use English
D1_SYNC_LANG=en d1-sync-local
Make sure you run the command in your Cloudflare Workers project directory.
Check that your wrangler.toml has D1 database configurations.
Make sure you have the necessary permissions to access the remote databases.
MIT
FAQs
Sync Cloudflare D1 remote databases to local development environment
The npm package d1-sync-local receives a total of 7 weekly downloads. As such, d1-sync-local popularity was classified as not popular.
We found that d1-sync-local demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Security News
/Company News
Socket has joined the new Composer and Packagist sponsorship program as a launch sponsor, supporting the team that keeps PHP's package ecosystem secure.

Research
/Security News
Benign-looking npm packages split malicious functionality across a dependency chain that deploys a cross-platform RAT targeting Alibaba developers.

Research
/Security News
Two Joyfill npm beta releases contain an import-time implant that uses blockchain transactions to retrieve a remote-access trojan.