Fundamentals
How Flare composes apps: arcs, build(), DI, config, lifecycle, logging, and validation.
Reviewed
Flare is composition-first: you register a graph on a FlareHost, then host.build() validates and compiles it before traffic arrives. These pages teach that model after the tutorials. Use the API Reference for signatures and validator codes.
Read The arc model for vocabulary, What build() does for the startup gate, and Dependency injection for how services wire together.
Core model
Section titled “Core model”- The arc model: The HTTP and WebSocket arcs on one host; request pipelines.
- What build() does: Compile, not bundle: graph validation and per-route codegen at startup.
- Lifecycle: starting → ready → draining → stopped; readiness probes and graceful shutdown.
- Host: FlareHost registration, adapters, run/export/test, and host.state.
- Host extensions: defineHostExtension: typed members on the host from packages.
Dependency injection
Section titled “Dependency injection”- Overview: Explicit static deps; why Flare does not use reflect-metadata.
- Using DI in apps: Register services, inject in controllers, and guard undeclared tokens.
- Named inject map: Inline route handlers: inject: { name: Token } and scope.name.
- Services and lifetimes: Scoped vs singleton; Workers constraints and onStart/onStop.
Configuration and logging
Section titled “Configuration and logging”- Configuration: flareConfig, flare.json, FLARE__ overrides, and host.cfg.
- Logging: Logger, transports, log context, and waitUntil on Workers.
Errors and validation
Section titled “Errors and validation”- Typed errors: flareErrorCodes, FlareError, categories, and exposed detail.
- Failure modes: When Flare throws: registration, build, compile, request, test.
- Build-time validation: The three validator families and what each one checks.