Modularizing The BrainDrive Backend

We’ve been working on a significant architectural improvement to BrainDrive: backend plugin support. This allows plugins to register their own REST API endpoints dynamically, without modifying the core codebase.

Why This Matters

Currently, BrainDrive plugins are frontend-only — they can add UI components but can’t provide server-side functionality. With backend plugin support, plugins will be able to:

  • Register custom API endpoints
  • Access server resources (databases, files, external APIs)
  • Provide full-stack functionality without core PRs

This opens the door for more powerful community plugins and keeps the core lean.

What We’ve Built (Phases 1-4)

Core Infrastructure (Phase 1)

  • @plugin_endpoint() decorator for marking plugin routes
  • PluginRouteLoader for dynamic route loading/unloading
  • Admin endpoint for controlled route reloading
  • Atomic swap pattern to prevent disruption during reloads

Plugin Metadata (Phase 2)

  • Database fields for plugin_type (frontend/backend/fullstack)
  • Support for endpoints_file, route_prefix, and backend_dependencies
  • Repository methods for querying backend plugins

Plugin Manager Integration (Phase 3)

  • Automatic route reload on install/enable/disable/uninstall
  • Cascade disable: disabling a backend plugin auto-disables dependents
  • Auto-install: installing a frontend plugin auto-installs required backends

Plugin Manager UI (Phase 4 - Just Completed!)

  • Plugin type tabs: Filter by All/Frontend/Backend/Fullstack
  • Backend badges: Visual distinction for backend and fullstack plugins
  • Dependency display: See which plugins depend on each backend plugin
  • Cascade disable warning: Confirmation dialog before cascade operations
  • Security warnings: Alerts when installing backend plugins (they run server-side code)

What’s Next

Phase 5 will create the first real backend plugin: the Library Plugin. This will provide API endpoints for accessing the BrainDrive Library (project management, context retrieval for AI agents).

Phase 6 will add comprehensive testing and documentation.

Follow the Progress

The work is happening in PR #216. @DJJones is reviewing.