
Offline-first MongoDB sync — Local + Atlas feel like ONE database. Automatic conflict resolution, Mongoose plugin, interactive CLI, zero boilerplate.
MongoFire keeps a local MongoDB and MongoDB Atlas in sync — automatically, reliably, and with zero boilerplate. Your app reads and writes to a local MongoDB instance that is always fast and always available, even when offline. MongoFire handles everything else in the background.
- ⚡ Offline-first — your app never waits for network
- 🔁 Automatic sync — local and remote changes reconciled
- 🛡 Field-level conflict resolution — prevents data loss
- 🔄 Schema migrations — automatic version upgrades
- 🏎 Diff/Patch — sync only changed fields to save bandwidth
- ⚙ Production-ready — rate limiting, circuit breaker, auto-compaction
- 🧰 CLI & TypeScript — easy management and full type support
📦 Configuration Options
- (configurable in mongofire.config.js)
- localUri — Local MongoDB connection string
- atlasUri — MongoDB Atlas URI
- dbName — Database name
- collections — Which collections to sync
- syncInterval — ms between automatic sync cycles
- batchSize — Documents per batch during sync
- syncOwner — Owner filter for multi‑tenant or per‑user sync
- realtime — Enable change streams
- onSync / onError — Hooks for logging and custom handling
🔄 Automatic Sync & Control API
- Programmatically manage sync:
- mongofire.start(config) → Start syncing (initial + background)
- mongofire.stop(timeout?) → Stop sync gracefully
- mongofire.sync(type?) → Manual sync trigger
- mongofire.status() → Get sync and queue status
- mongofire.clean(days?, opts) → Clean old synced records
- mongofire.conflicts() → List sync conflicts
- mongofire.retryConflict(opId) → Retry a conflict operation
- mongofire.dismissConflict(opId) → Dismiss and let remote win
- mongofire.reconcile(...) → Recover writes lost in a crash
- mongofire.resetLocal() → Safely wipe local DB + state
CLI Tools & Commands
- Interactive terminal commands that MongoFire provides:
- npx mongofire init — Setup wizard
- mongofire config — Update config
- mongofire status — Show pending ops/state
- mongofire clean, conflicts, reconcile, reset-local — Tools for maintenance and recovery
Advanced Features
- Full TypeScript Interfaces — TS types available for SyncConfig, SyncResult, ConflictData, etc.
- Safe Local Reset/Re‑bootstrap — Wipes local DB but resumes cleanly on next start.
- Manual Conflict Tools — You can manually inspect conflicts, retry, or dismiss.
- Real‑time Sync Fallback — If change streams aren’t available, it will fall back to polling.
Mongofire on Npm
Top comments (1)
MongoFire — Offline-first MongoDB sync with automatic conflict resolution, real-time optional mode, multi-user support, and zero boilerplate. Keep your local and Atlas databases in sync, even offline. ⚡💾🔁