Skip to content

refactor: implement dual-backend settings support (MySQL & MongoDB)#163

Open
NoLogicAlan wants to merge 5 commits intoremix-bot:mainfrom
NoLogicAlan:main
Open

refactor: implement dual-backend settings support (MySQL & MongoDB)#163
NoLogicAlan wants to merge 5 commits intoremix-bot:mainfrom
NoLogicAlan:main

Conversation

@NoLogicAlan
Copy link
Member

@NoLogicAlan NoLogicAlan commented Mar 4, 2026

Changes

Implemented a dynamic database provider system that supports both MySQL and MongoDB, allowing the bot to adapt to different hosting environments.

  • Hybrid Backend Support: Refactored the core logic to allow the bot to switch between MySQL and MongoDB based on the config.json settings.
  • New RemoteSettingsManager: Introduced a MongoDB-native class with efficient upsert logic to handle settings persistence without data duplication.
  • Database Auto-Selection: Updated index.js to automatically initialize the correct provider at startup, ensuring a "Smart Fallback" if a specific backend isn't configured.
  • Migration Utility: Included migrate.js to facilitate a smooth, one-time transition for users moving their existing data from MySQL to MongoDB collections.
  • Updated Configuration Schema: Enhanced config.json to support separate connection strings and credentials for both database types.

Checklist

  • I have checked the issue tracker for duplicates
  • I have tested my changes locally and they are working as intended
  • These changes do not have any notable side effects on other Remix projects

Replaced the local file-based/MySQL SettingsManager with a new
RemoteSettingsManager backed by MongoDB via the native driver.

Changes:
- Added RemoteSettingsManager class using mongodb package
- Settings are now persisted and loaded from a MongoDB collection
- Added upsert logic for creating/updating server settings
- Added migrate.js script for one-time data migration from old storage
- Updated config.json to include mongodb.uri and mongodb.database fields
- Updated index.js to use RemoteSettingsManager
@NoLogicAlan NoLogicAlan requested a review from ShadowLp174 March 4, 2026 23:00
- migrate.js and index.js now read config.db to pick MongoDB or MySQL
- Replaced hardcoded RemoteSettingsManager with createSettingsManager factory
- No code changes needed to switch backends, just set "db" in config.json
@NoLogicAlan NoLogicAlan changed the title refactor: MySQL to MongoDB settings migration refactor: implement dual-backend settings support (MySQL & MongoDB) Mar 5, 2026
@NoLogicAlan NoLogicAlan removed the request for review from ShadowLp174 March 7, 2026 13:08
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant