Closes #72 /claim #72
Implement a comprehensive data replication plugin for StarbaseDB that enables users to pull data from external databases (PostgreSQL, MySQL, etc.) into the internal SQLite database with configurable sync intervals and incremental updates.
This addresses the request for creating a βpull mechanismβ to replicate data from external sources like Supabase PostgreSQL into StarbaseDBβs edge-close SQLite replica.
https://github.com/user-attachments/assets/b44e78c6-0e76-4cde-a489-e4ab87e23a96
plugins/data-replication/index.ts
npm run build && npx wrangler deploy
curl -X POST https://starbasedb.mavrickrishi.workers.dev/data-replication/configure \
-H "Content-Type: application/json" \
-H "Authorization: Bearer ABC123" \
-d '{"name":"test","sourceConfig":{"dialect":"postgresql","host":"demo.supabase.co","port":5432,"user":"postgres","password":"demo-pass","database":"postgres"},"targetTable":"users","sourceTable":"users","syncIntervalMinutes":30,"trackingColumn":"updated_at"}'
curl -X GET https://starbasedb.mavrickrishi.workers.dev/data-replication/status -H "Authorization: Bearer ABC123"
GitHub Issue #72 Request:
StarbaseDB Plugin Ecosystem:
plugins/
βββ cdc/ # Change Data Capture
βββ cron/ # Scheduled tasks
βββ query-log/ # Query logging
βββ stats/ # System statistics
βββ [missing data replication]
β Complete Data Replication System:
plugins/data-replication/
βββ index.ts # Main plugin (475+ lines)
βββ index.test.ts # Unit tests (3 passing)
βββ meta.json # Plugin metadata
βββ README.md # Comprehensive docs
POST /data-replication/configure
- Set up replicationPOST /data-replication/start/:name
- Start specific replicationPOST /data-replication/stop/:name
- Stop specific replicationPOST /data-replication/sync/:name
- Manual sync triggerGET /data-replication/status
- View all configurationsGET /data-replication/logs
- Sync operation logsDELETE /data-replication/configure/:name
- Remove configTwo new internal tables created:
tmp_replication_configs
- Store replication settingstmp_replication_logs
- Track sync operations and performance# β
TESTED: Configuration successful
{"result":{"success":true,"message":"Replication configured successfully"}}
# β
TESTED: Status shows active replication
{"result":{"configs":[{"name":"supabase-users","is_running":true,"sync_interval_minutes":30}]}}
β
Pull mechanism for external databases
β
Configurable sync intervals
β
Table-specific replication
β
Incremental updates via tracking columns
β
Supabase PostgreSQL support
β
Edge-close SQLite replica creation
β
wrangler.toml configuration support
Rishi Mondal
@MAVRICK-1
Outerbase (YC W23)
@outerbase