10 releases (4 breaking)

0.5.0 Mar 19, 2024
0.4.0 Feb 7, 2024
0.3.0 Dec 20, 2023
0.2.5 Dec 12, 2023
0.1.0 Dec 4, 2023

#393 in Development tools

Download history 1/week @ 2023-12-21 26/week @ 2024-01-04 25/week @ 2024-01-11 25/week @ 2024-01-18 37/week @ 2024-01-25 51/week @ 2024-02-01 38/week @ 2024-02-08 56/week @ 2024-02-15 107/week @ 2024-02-22 53/week @ 2024-02-29 24/week @ 2024-03-07 198/week @ 2024-03-14 159/week @ 2024-03-21 128/week @ 2024-03-28 89/week @ 2024-04-04

577 downloads per month
Used in 2 crates (via devtools-core)

MIT/Apache

83KB
1.5K SLoC

Devtools banner

Devtools for Tauri

Inspect, monitor, and understand your Tauri application with ease.

  • Easy Integration: With just a few lines of code, enable detailed event logging and metadata extraction for your application.
  • Rich Insights: Get insight into what your app is doing, Performance, Errors, Warnings, everything is available at a glance.
  • And more: This project is actively worked on, and we are open to hear your ideas, check out the Upcoming Features issue for details.

Getting Started

[!TIP] For the full documentation, check: docs.crabnebula.dev/devtools

Tauri v1

Ensure you have Tauri set up correctly. Then install the Rust instrumentation from crates.io:

cargo add devtools

You also have to use Tauri 1.5.3 (or later) so your Cargo.toml file should look as follows::

[dependencies]
devtools = "0.3.0"
tauri = "1.5.3"
[build-dependencies]
tauri-build = "1.5.0"

Tauri v2

Ensure you have Tauri set up correctly. Then install the Rust instrumentation from crates.io:

cargo add tauri-plugin-devtools --git https://github.com/crabnebula-dev/devtools

You also have to use Tauri 2.0.0-beta.1 (or later) so your Cargo.toml file should look as follows:

[dependencies]
tauri-plugin-devtools = { git = "https://github.com/crabnebula-dev/devtools" }
tauri = "2.0.0-beta.3"
[build-dependencies]
tauri-build = "2.0.0-beta"

Plugin Initialization

Then add the following snippet to your tauri initialization code:

fn main() {
    // This should be called as early in the execution of the app as possible
    #[cfg(debug_assertions)] // only enable instrumentation in development builds
    let devtools = tauri_plugin_devtools::init();

    let builder = tauri::Builder::default();

    #[cfg(debug_assertions)]
    let builder = builder.plugin(devtools);

    builder
        .run(tauri::generate_context!())
        .expect("error while running tauri application");
}

And then run your app as usual, if everything is set up correctly devtools will print the following message:

Screenshot 2023-11-28 at 14.05.20.png

You can click or copy & paste the link into your browser to open up the UI. Alternatively you can navigate to https://devtools.crabnebula.dev and connect from there.

Android

The Android emulator runs behind a virtual router that isolates it from the development machine network interfaces. To access the WebSocket server started by the Devtools on your machine, you must set up network redirection:

  • Via adb:
adb forward tcp:3000 tcp:3000
  • Via the emulator console:
# first emulator launches on port 5554, you might need to find out the port via `$ adb devices`
telnet localhost 5554
auth <insert-auth-token-here> # insert token from `$HOME/.emulator_console_auth_token`
# redirect host connections to 3000 to emulator port 3000
redir add tcp:3000:3000

For more information, see the official documentation.

Features

Console

The Console tab lets you quickly and conveniently see what your app is doing. Any errors, warnings or other messages produced by your code, Tauri or your dependencies will show up here.

Calls

Commands are at the core of your Tauri app, and the Calls tab is designed to let you debug and troubleshoot any issues that you might have. It will display arguments and returns for each command as well as a detailed performance breakdown of exactly how much processing time your command spent on what.

Config Viewer

The Config Viewer will present you with a detailed breakdown of your Tauri configuration and in the future also include warnings, tips and hints.

License

The Instrumentation (i.e. the folders /wire and /devtools) is licensed under either of Apache License, Version 2.0 or MIT license at your option.

All other code is licensed under the PolyForm Noncommercial License 1.0.0.

⚠️ Unless you explicitly state otherwise, any contribution intentionally submitted for inclusion in this project by you, shall be licensed as above, without any additional terms or conditions.

Dependencies

~4.5–6MB
~103K SLoC