- For tokio: Structure Actix-web server entry point in src/main.rs with App configuration and route registration.
- Define custom error types in src/error.rs supporting structured logging and Actix responders.
- Place request/response DTOs in src/models/ implementing serde Serialize/Deserialize.
- Implement adapters in src/adapters/ for external services using ports & adapters pattern.
- Enable graceful shutdown on server signals in main.rs.
- For tokio: Extract typed path parameters: `async fn get_user(path: web::Path<(u32,)>) -> impl Responder` — use `web::Query<T>` for query strings.
- Use `web::Data<T>` for shared application state: `App::new().app_data(web::Data::new(pool.clone()))` — access in handlers as `data: web::Data<Pool>`.
- Define JSON request bodies with `web::Json<T>`: `async fn create(body: web::Json<CreateUser>) -> impl Responder` — auto-deserializes with serde.
- Use middleware with `.wrap()`: `App::new().wrap(Logger::default()).wrap(Cors::permissive())`.