Application startup
A typical application starts in this order:1
Create the application
App() provides the central application object and service container.2
Load configuration
AppConfig.create() reads JSON configuration files and is usually bound as an eager singleton.3
Register providers
Providers bind services, migrations, clients, seeders, or other application capabilities.
4
Boot the application
app.boot() prepares framework services, initializes eager bindings, and runs provider boot work.5
Resolve runtime services
After boot, resolve services such as
Router and StaticFilesServer from the container.A provider’s
register() phase defines bindings. Its boot() phase performs work that may depend on bindings from other providers.Request lifecycle
For each incoming request:HttpServeryields aHttpRequest.StaticFilesServer.tryServe()handles matching public assets.AppKernel.handle()prepares the request and invokes global middleware.Router.dispatch()matches an exact or typed dynamic route.- Route middleware runs in its defined order.
- The route handler writes a JSON, text, view, redirect, file, or error response.
- Unmatched requests receive the framework’s 404 response.
Component responsibilities
Failure and shutdown
A startup or listener failure should be logged and followed by explicit resource cleanup. Close the HTTP server and external clients, callapp.container.dispose() when you rely on container disposal callbacks, and then call app.shutdown() to update the application lifecycle.
Service container
Learn how Archery owns and resolves services.
Build a small app
Apply the request lifecycle in a working JSON API.