Metadata-Version: 2.4
Name: simple_module_hosting
Version: 0.0.7
Summary: FastAPI + Inertia.js host runtime for simple_module — app_builder, middleware stack, CLI (sm / simple-module), scaffolding
Project-URL: Homepage, https://github.com/antosubash/simple_module_python
Project-URL: Repository, https://github.com/antosubash/simple_module_python
Project-URL: Issues, https://github.com/antosubash/simple_module_python/issues
Project-URL: Changelog, https://github.com/antosubash/simple_module_python/blob/main/CHANGELOG.md
Author-email: Anto Subash <antosubash@live.com>
License-Expression: MIT
License-File: LICENSE
Keywords: fastapi,inertia,scaffolding,simple-module,starlette,uvicorn
Classifier: Development Status :: 3 - Alpha
Classifier: Framework :: FastAPI
Classifier: Intended Audience :: Developers
Classifier: License :: OSI Approved :: MIT License
Classifier: Operating System :: OS Independent
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3.12
Classifier: Topic :: Internet :: WWW/HTTP :: WSGI :: Application
Classifier: Topic :: Software Development :: Libraries :: Application Frameworks
Classifier: Typing :: Typed
Requires-Python: >=3.12
Requires-Dist: click>=8.1
Requires-Dist: fastapi-inertia>=1.0
Requires-Dist: fastapi>=0.115
Requires-Dist: httpx>=0.27
Requires-Dist: jinja2>=3.1
Requires-Dist: simple-module-core==0.0.7
Requires-Dist: simple-module-db==0.0.7
Requires-Dist: starlette>=0.44
Requires-Dist: tomlkit>=0.13
Requires-Dist: uvicorn[standard]>=0.34
Description-Content-Type: text/markdown

# simple_module_hosting

FastAPI + Inertia.js host runtime for the [simple_module](https://github.com/antosubash/simple_module_python) framework — builds the app, wires the middleware pipeline, and contributes the `sm host` plugin to the standalone `sm` CLI.

## Install

```bash
pip install simple_module_hosting
```

For a new project, most users run the generator instead (shipped by the standalone `simple_module_cli` distribution):

```bash
uvx --from simple_module_cli sm new my-app
```

## What it provides

- `create_app(settings)` — returns a fully-wired `FastAPI` instance 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.
- `sm host` plugin — `sm host gen-pages` regenerates the frontend pages manifest; `sm host sync-js-deps` installs JS deps declared by installed modules. The `sm` binary itself comes from `simple_module_cli`.

## Usage

Minimal `main.py`:

```python
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`):

```bash
sm host gen-pages               # regenerate client_app/modules.generated.ts
sm host sync-js-deps            # sync module JS deps into client_app/node_modules
```

## Depends on

- `simple_module_core`, `simple_module_db`
- `fastapi`, `fastapi-inertia`, `starlette`, `uvicorn`, `click`, `jinja2`, `httpx`

## License

MIT — see [LICENSE](https://github.com/antosubash/simple_module_python/blob/main/LICENSE).
