FastAPI + Inertia.js host runtime for the simple_module framework — builds the app, wires the middleware pipeline, and contributes the smpy host plugin to the standalone smpy CLI.
pip install simple_module_hostingFor a new project, most users run the generator instead (shipped by the standalone simple_module_cli distribution):
uvx --from simple_module_cli smpy new my-appcreate_app(settings)— returns a fully-wiredFastAPIinstance with all discovered modules registered.- Middleware pipeline (execution order): CorrelationId → RequestLogging → SecurityHeaders → Session →
<module middleware>→ Tenant (opt-in) → Locale → InertiaLayoutData → app. - Inertia wiring — shared props (
auth,menus,i18n),InertiaDep, page-route lookup. smpy hostplugin —smpy host gen-pagesregenerates the frontend pages manifest;smpy host sync-js-depsinstalls JS deps declared by installed modules. Thesmpybinary itself comes fromsimple_module_cli.
Minimal main.py:
from simple_module_hosting import create_app
from simple_module_hosting.settings import Settings
settings = Settings() # reads SM_* env vars
app = create_app(settings) # discovers + registers every installed module
if __name__ == "__main__":
import uvicorn
uvicorn.run(app, host="0.0.0.0", port=8000)CLI (after also installing simple_module_cli):
smpy host gen-pages # regenerate client_app/modules.generated.ts
smpy host sync-js-deps # sync module JS deps into client_app/node_modulessimple_module_core,simple_module_dbfastapi,fastapi-inertia,starlette,uvicorn,click,jinja2,httpx
MIT — see LICENSE.