Plugins

Flaxon provides a plugin system that allows you to extend the framework with modular components.

Available Plugins

Official Flaxon plugins with Three.js powered previews.

๐Ÿง  flaxon-ai Alpha

AI/LLM integration with Gemini, OpenAI, and local Flax/JAX models.

pip install flaxon-ai[all]
๐Ÿ“ฑ flaxon-mobile Alpha

Mobile backend services with push notifications and Android/iOS support.

pip install flaxon-mobile[all]
๐Ÿ” flaxon-oauth-google Alpha

Google OAuth 2.0 authentication for Flaxon applications.

pip install flaxon-oauth-google
๐Ÿ”— flaxon-inertia Alpha

Inertia.js integration for Vue, React, and Svelte frontends.

pip install flaxon-inertia
๐Ÿ”ฅ flaxon-fyr Alpha

Fyr.js CDN-only reactive framework integration.

pip install flaxon-fyr
๐Ÿ› flaxon-debug-toolbar Alpha

Debug toolbar with Three.js 3D visualizations.

pip install flaxon-debug-toolbar
๐Ÿ“ก flaxon-sentry Alpha

Sentry error tracking and performance monitoring.

pip install flaxon-sentry
๐Ÿงช flaxon-pytest Alpha

Pytest fixtures and utilities for testing Flaxon applications.

pip install flaxon-pytest

Creating a Plugin

Flaxon plugins are simple Python classes that extend the framework.

from flaxon.plugins import Plugin

class MyPlugin(Plugin):
    name = "my-plugin"
    version = "1.0.0"
    description = "A custom Flaxon plugin"

    def setup(self, app):
        @app.get("/plugin")
        async def plugin_route():
            return {"plugin": "MyPlugin"}

        app.add_middleware(MyPluginMiddleware)
        app.state.plugin_loaded = True

Simple Plugin

from flaxon.plugins import SimplePlugin

def setup_plugin(app):
    @app.get("/simple")
    async def simple_route():
        return {"plugin": "Simple"}

plugin = SimplePlugin("simple-plugin", setup_plugin)

Plugin Lifecycle

class LifecyclePlugin(Plugin):
    name = "lifecycle-plugin"
    version = "1.0.0"

    def on_load(self):
        print("Plugin loaded")

    def setup(self, app):
        print("Plugin setup")

    def on_startup(self):
        print("Plugin startup")

    def on_shutdown(self):
        print("Plugin shutdown")

    def on_unload(self):
        print("Plugin unloaded")

Plugin Dependencies

class CorePlugin(Plugin):
    name = "core-plugin"
    version = "1.0.0"
    provides = ["database", "cache"]

class DatabasePlugin(Plugin):
    name = "database-plugin"
    version = "1.0.0"
    requires = ["core-plugin"]
    provides = ["postgres"]
Tip

Plugins can add routes, middleware, CLI commands, health checks, and lifecycle hooks.