Fusion Framework logo by Cipher UnitFusion

Application lifecycle

What happens from process start to FusionApp.listen

What

The application lifecycle is the ordered sequence of steps from starting your process to serving HTTP traffic.

Startup sequence

flowchart TD
  A[Process start] --> B[Import route modules]
  B --> C[Route classes register with binding]
  C --> D[load_settings_module / EnsureLoaded]
  D --> E[FusionApp constructed]
  E --> F[Optional app.use middleware]
  F --> G[listen / Listen]
  G --> H[Mount routes on Hyper]
  H --> I[Mount Swagger if enabled]
  I --> J[Accept connections]

Step details

StepWhat happens
Import / registerPython/Node: decorators run at import. C#: Route.Register<T>()
SettingsLoad fusion.<env>.json (FUSION_ENV, default dev). Python may merge UPPERCASE attrs from settings / core.settings
FusionAppHolds settings, middleware list, native engine handle
MiddlewareGlobal chain prepared (see binding notes on framework_headers)
listenBinding mounts registered routes, optional Swagger routes, binds host/port, blocks serving

Settings flow

flowchart LR
  Env[FUSION_ENV] --> File["fusion.<env>.json"]
  File --> Core[fusion-core Settings]
  Py[Python settings.py UPPERCASE] --> Core
  Core --> App[FusionApp host/port/swagger/fingerprint]

If the JSON has a top-level config object (CLI scaffold style), that object is merged as settings. Otherwise top-level keys (except env / commands) are merged.

Shutdown

listen() typically blocks until the process is terminated. There is no separate Fusion “graceful shutdown API” documented beyond normal process signals — treat OS signal handling as application responsibility unless your binding exposes dispose/using patterns (C# FusionApp is IDisposable).

Next

On this page