How rwf2/rocket works
Rocket is an asynchronous Rust web framework. In the main workflow, an application declares and mounts routes, starts a server, and an incoming HTTP request is parsed and dispatched to a matching handler; the handler’s result is converted to a response and sent back. The repository also provides request/data handling, catchers, file serving, templates, database pools, WebSockets, TLS, and local clients. The graph combines README-described behavior with source-index references and sampled excerpts; several extension internals were not sampled, so their links are limited to documented or indexed relationships.
Main entry points: rocket.rs Rocket application · server.rs HTTP server · handler.rs Route handlers · router.rs Route matching
Components 26
Application Setup
- Rocket application
core/lib/src/rocket.rs - Configuration and state
core/lib/src/config/config.rs - Launch lifecycle
core/lib/src/lifecycle.rs - Fairings
core/lib/src/fairing/fairings.rs
HTTP Runtime
- Network listeners
core/lib/src/listener/mod.rs - HTTP server
core/lib/src/server.rs - Request and guards
core/lib/src/request/request.rs - Request data
core/lib/src/data/data.rs - Route matching
core/lib/src/router/router.rs - Route handlers
core/lib/src/route/handler.rs - Response construction
core/lib/src/response/response.rs - Error catchers
core/lib/src/catcher/handler.rs
HTTP Types
- HTTP and URI types
core/http/src/uri/path_query.rs - Cookie handling
core/lib/src/http/cookies.rs
Framework Extensions
- Static file server
core/lib/src/fs/server.rs - Dynamic templates
contrib/dyn_templates/src/template.rs - Template discovery
contrib/dyn_templates/src/context.rs - Template engines
contrib/dyn_templates/src/engine/mod.rs - Async database pools
contrib/db_pools/lib/src/database.rs - Sync database pools
contrib/sync_db_pools/lib/src/lib.rs - WebSockets
contrib/ws/src/websocket.rs - Local test clients
core/lib/src/local/client.rs - TLS and mTLS
core/lib/src/tls/listener.rs
Compile-Time APIs
- Route and launch macros
core/codegen/src/lib.rs
Other components
- Application developer
- HTTP client
Connections 29
- Application developer → Route and launch macros: declares routes
README.md - Application developer → Rocket application: mounts routes
README.md - Route and launch macros → Route handlers: generates handlers
- Rocket application → Configuration and state: uses configuration
- Rocket application → Launch lifecycle: starts application
- Rocket application → Fairings: attaches fairings
- Rocket application → HTTP server: starts serving
- HTTP server → Network listeners: accepts connections
core/lib/src/server.rs - HTTP client → Network listeners: sends HTTP
README.md - HTTP server → Route matching: dispatches requests
core/lib/src/server.rs - Route matching → Request and guards: matches request
core/lib/src/router/router.rs - Route matching → Route handlers: selects route
core/lib/src/router/router.rs - Route handlers → Response construction: builds response
core/lib/src/route/handler.rs - Route handlers → Request and guards: handles request
core/lib/src/route/handler.rs - Route handlers → Request data: consumes data
core/lib/src/route/handler.rs - Route matching → Error catchers: selects catcher
core/lib/src/router/router.rs - HTTP server → HTTP and URI types: uses HTTP types
core/lib/src/server.rs - Request and guards → HTTP and URI types: uses HTTP types
- Response construction → HTTP and URI types: uses HTTP types
- Request and guards → Cookie handling: exposes cookies
- Rocket application → Static file server: mounts file server
core/lib/src/fs/server.rs - Dynamic templates → Template discovery: initializes context
contrib/dyn_templates/src/template.rs - Template discovery → Template engines: initializes engines
contrib/dyn_templates/src/context.rs - Dynamic templates → Template engines: renders templates
contrib/dyn_templates/src/engine/mod.rs - Rocket application → Async database pools: integrates pools
- Rocket application → Sync database pools: integrates pools
- Rocket application → WebSockets: supports upgrades
- Local test clients → HTTP server: exercises server
- Network listeners → TLS and mTLS: supports TLS