Plugin Lifecycle
Understanding how plugins are loaded, initialized, and executed in Frame-Master.
🔄 Lifecycle Overview
Plugins go through distinct phases during the server lifecycle.
1
Initialization
Plugins loaded, sorted by priority, requirements validated
2
Server Startup
serverStart hooks execute, runtime plugins loaded
3
Request Processing
Router hooks handle each HTTP request
4
Build Process
Build hooks customize compilation
📋 Execution Flow
When and how each hook type executes.
// Server Start (once)
serverStart.main() → serverStart.dev_main()
// Each Request
before_request → request → after_request → html_rewrite → global_value_injection
// Build
buildConfig → beforeBuild → [Bun Build] → afterBuild
📊 Priority Order
Lower priority numbers execute first.
frame-master.config.ts
export default defineConfig({plugins: [logging(), // priority: 100 → runs lastreactSSR(), // priority: 50 → runs midsession(), // priority: 10 → runs secondauth(), // priority: 0 → runs first],}); // Order: auth → session → reactSSR → logging
Auth
0-10Session/DB
10-30Processing
30-60Logging
80-100✨ Best Practices
Tips for effective lifecycle management.
⚡
Keep Hooks Lightweight
Move heavy operations to serverStart.
🔒
Handle Errors
Wrap hook logic in try-catch.
