Actix-web

Set up debugger in a Rust project using the Actix-web framework.

Last updated March 19, 2026

Rust + Actix-web

This guide covers adding debugger to a Rust API using Actix-web.

Actix-web official docs

Feature Support
Server console Yes
Server errors Via tracing
HTTP requests Yes
Browser script injection Manual

Prerequisites

  • Rust 1.75 or later

Install

Add the crate to your Cargo.toml:

[dependencies]
ephem-debugger = { version = "0.1", features = ["actix"] }

Set up

use actix_web::{web, App, HttpServer, middleware};
use ephem_debugger::actix_middleware::{self, debugger_mw};
use tracing_subscriber::prelude::*;

#[actix_web::main]
async fn main() -> std::io::Result<()> {
    let capture_layer = actix_middleware::init(8080);

    tracing_subscriber::registry()
        .with(capture_layer)
        .with(tracing_subscriber::fmt::layer())
        .init();

    HttpServer::new(|| {
        App::new()
            .wrap(middleware::from_fn(debugger_mw))
            .route("/", web::get().to(handler))
    })
    .bind("0.0.0.0:8080")?
    .run()
    .await
}

Verify

cargo run
npx dbg status
pnpm dlx dbg status
bun x dbg status
yarn dlx dbg status
npx dbg server console
pnpm dlx dbg server console
bun x dbg server console
yarn dlx dbg server console

Browser support

Register browser routes with browser_config:

App::new()
    .configure(actix_middleware::browser_config)
    .wrap(middleware::from_fn(debugger_mw))

Add script tags before </body> in your HTML templates:

<script>window.__DEBUGGER_INGEST_URL__="/_/d";</script>
<script src="/_/d.js" defer></script>

Full example

See the complete working example at examples/rust/actix.

Search Documentation

Search for pages and content