Flash ORM Plugin System
Flash ORM uses a modular plugin architecture that allows you to install only the features you need, significantly reducing binary size and installation footprint.
Overview
The base Flash ORM CLI is a minimal binary that provides:
- Version information (
flash --version) - Plugin management (
flash plugins,flash add-plug,flash rm-plug) - Command metadata and help
- Automatic plugin download on first use
All actual ORM functionality is provided through plugins.
Available Plugins
Core Plugin (core)
Description: Complete ORM features — migrations, code generation, seeding, schema management, and export.
Includes:
init— Initialize a new FlashORM projectmigrate— Create new migration filesapply— Apply pending migrationsstatus— Check migration statuspull— Pull current database schemareset— Reset database and reapply all migrationsdown— Rollback migrationsraw— Execute raw SQL queriesbranch— Manage database schema branchesgen— Generate type-safe code (Go, TypeScript, Python)export— Export database to JSON, CSV, or SQLiteseed— Seed database with realistic fake data
Auto-install: The core plugin installs automatically the first time you run any ORM command. You do not need to install it manually.
Studio Plugin (studio)
Description: Visual database editor and management interface.
Includes:
studio— Launch the web-based database GUI- Browse and edit table data
- Export and import database (Schema Only, Data Only, Complete)
- Visual schema viewer with relationship graph
- SQL query runner with CSV export
- Branch management interface
Install manually when you need the visual editor:
flash add-plug studioPlugin Management
List Installed Plugins
flash pluginsInstall a Plugin
flash add-plug core
flash add-plug studioRemove a Plugin
flash rm-plug studioUpdate Plugins
# Update all installed plugins
flash update
# Update plugins and the flash binary
flash update --self
# Update only the flash binary
flash update --self-onlyHow Plugin Loading Works
When you run a command, Flash ORM:
- Checks if the command is built into the base CLI
- If not, checks the plugin registry for which plugin provides the command
- If the required plugin is not installed, downloads it automatically (core only)
- Delegates execution to the plugin binary with your arguments and environment
Plugin Storage
Plugins are stored in your home directory:
~/.flash/plugins/
├── flash-plugin-core
├── flash-plugin-studio
└── registry.jsonDistribution
Plugins are distributed through GitHub Releases and downloaded automatically when needed. Flash ORM determines your platform and architecture, downloads the appropriate binary, verifies its checksum, and saves it to the plugin directory.
Plugin updates require explicit confirmation:
flash plugins update
# Output: "Update core from v2.1.10 to v2.1.11? (y/N)"Permission Model
Plugins run with the same permissions as the base CLI:
- No elevated privileges
- Access to user files and databases
- Network access for database connections
- No system-level modifications
Performance
Startup Time
Plugin architecture optimizes startup:
- Base CLI: ~50ms startup time
- Plugin loading: ~100-200ms additional
- Total: ~150-250ms (comparable to monolithic CLI)
Memory Usage
Memory-efficient design:
- Base CLI: ~10MB RAM
- Core plugin: ~25MB additional
- Studio plugin: ~30MB additional (includes web server)
Disk Space
Minimal footprint:
- Base CLI: ~8MB
- Core plugin: ~22MB
- Studio plugin: ~21MB
- Total with all plugins: ~51MB
Use Cases
Development Environments
# Minimal setup for CI/CD
npm install -g flashorm
flash add-plug core
# Full development setup
flash add-plug allProduction Deployments
# Production servers (CLI only)
flash add-plug core
# Development servers (with studio)
flash add-plug allTeam Workflows
# Backend developers
flash add-plug core
# Full-stack developers
flash add-plug all
# Database administrators
flash add-plug studioResource-Constrained Environments
# IoT devices, containers
flash add-plug core # Minimal footprint
# Development containers
flash add-plug all # Full functionalityTroubleshooting
Plugin Installation Issues
Permission denied
# Check plugin directory permissions
ls -la ~/.flash/
# Fix permissions
chmod 755 ~/.flash/
chmod 755 ~/.flash/plugins/Network issues
# Check connectivity
curl -I https://github.com/Lumos-Labs-HQ/flash/releases
# Use proxy if needed
export HTTPS_PROXY=http://proxy.company.com:8080
flash add-plug coreChecksum verification failed
# Clear plugin cache
rm -rf ~/.flash/plugins/
flash add-plug corePlugin Loading Issues
Plugin not found
# Check plugin installation
flash plugins
# Reinstall plugin
flash rm-plug core
flash add-plug coreCommand not available
# Check if plugin provides command
flash plugins --commands
# Update plugin
flash plugins update corePerformance Issues
Slow plugin loading
# Check disk I/O
iostat -x 1
# Check available memory
free -h
# Restart with clean state
flash rm-plug all
flash add-plug coreFuture Enhancements
Planned Features
- Plugin Marketplace: Community plugin repository
- Plugin Dependencies: Automatic dependency resolution
- Plugin Updates: Background update notifications
- Plugin Sandboxing: Enhanced security isolation
- Plugin Metrics: Usage and performance monitoring
Custom Plugins
Support for user-created plugins:
// Custom plugin example
type CustomPlugin struct{}
func (p *CustomPlugin) Name() string { return "analytics" }
func (p *CustomPlugin) Commands() []cobra.Command {
return []cobra.Command{
{
Use: "analytics",
Short: "Run analytics queries",
RunE: runAnalytics,
},
}
}The plugin system makes Flash ORM incredibly flexible and efficient. You can install exactly the features you need, when you need them, without bloat or unnecessary dependencies.