3 releases (stable)

new 2.0.0 Nov 28, 2023
1.0.0 Oct 7, 2023
0.1.0 Aug 7, 2023

#5 in #rest-api

Download history 202/week @ 2023-08-08 282/week @ 2023-08-15 299/week @ 2023-08-22 651/week @ 2023-08-29 378/week @ 2023-09-05 665/week @ 2023-09-12 783/week @ 2023-09-19 801/week @ 2023-09-26 1320/week @ 2023-10-03 977/week @ 2023-10-10 1089/week @ 2023-10-17 1513/week @ 2023-10-24 1495/week @ 2023-10-31 1885/week @ 2023-11-07 1940/week @ 2023-11-14 1574/week @ 2023-11-21

7,277 downloads per month
Used in 4 crates


4.5K SLoC


This crate works as a bridge between utoipa and RapiDoc OpenAPI visualizer.

Utoipa build crates.io docs.rs rustc

Utoipa-rapidoc provides simple mechanism to transform OpenAPI spec resource to a servable HTML file which can be served via predefined framework integration or used standalone and served manually.

You may find fullsize examples from utoipa's Github repository.

Crate Features

  • actix-web Allows serving RapiDoc via actix-web. version >= 4
  • rocket Allows serving RapiDoc via rocket. version >=0.5.0-rc.3
  • axum Allows serving RapiDoc via axum. version >=0.7


Use RapiDoc only without any boiler plate implementation.

utoipa-rapidoc = "2"

Enable actix-web integration with RapiDoc.

utoipa-rapidoc = { version = "2", features = ["actix-web"] }

Using standalone

Utoipa-rapidoc can be used standalone as simply as creating a new RapiDoc instance and then serving it by what ever means available as text/html from http handler in your favourite web framework.

RapiDoc::to_html method can be used to convert the RapiDoc instance to a servable html file.

let rapidoc = RapiDoc::new("/api-docs/openapi.json");

// Then somewhere in your application that handles http operation.
// Make sure you return correct content type `text/html`.
let rapidoc_handler = move || {


Utoipa-rapidoc can be customized and configured only via RapiDoc::custom_html method. This method empowers users to use a custom HTML template to modify the looks of the RapiDoc UI.

The template should contain $specUrl variable which will be replaced with user defined OpenAPI spec url provided with RapiDoc::new function when creating a new RapiDoc instance. Variable will be replaced during RapiDoc::to_html function execution.

Overiding the HTML template with a custom one.

let html = "...";


Serve RapiDoc via actix-web framework.

use actix_web::App;
use utoipa_rapidoc::RapiDoc;

App::new().service(RapiDoc::with_openapi("/rapidoc", ApiDoc::openapi()));

Serve RapiDoc via rocket framework.

use utoipa_rapidoc::RapiDoc;

        RapiDoc::with_openapi("/rapidoc", ApiDoc::openapi()),

Serve RapiDoc via axum framework.

use axum::Router;
use utoipa_rapidoc::RapiDoc;
let app = Router::<S>::new()
    .merge(RapiDoc::with_openapi("/rapidoc", ApiDoc::openapi()));


Licensed under either of Apache 2.0 or MIT license at your option.

Unless you explicitly state otherwise, any contribution intentionally submitted for inclusion in this crate by you, shall be dual licensed, without any additional terms or conditions.


~612K SLoC