Skip to content

Fundamentals

How Flare composes apps: arcs, build(), DI, config, lifecycle, logging, and validation.

Reviewed Updated 10 days ago · Flare 0.3

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.

  • 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.
  • 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: flareConfig, flare.json, FLARE__ overrides, and host.cfg.
  • Logging: Logger, transports, log context, and waitUntil on Workers.
  • 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.