How to Enable Specific Features for the Tauri Shell in OpenHuman: A Complete Guide
Enable Tauri shell features in OpenHuman by adding feature flags to app/src-tauri/Cargo.toml and rebuilding with cargo build --features "feature-name".
OpenHuman's desktop client is built with Tauri v2, and its shell functionality is controlled through Cargo's feature system. This guide shows you how to locate the feature configuration, enable specific capabilities like the updater or custom protocols, and rebuild the application with your selected features.
Locating the Tauri Shell Configuration
The Tauri shell in OpenHuman is defined as a Rust crate located at app/src-tauri/. The primary configuration file for feature toggles is:
app/src-tauri/Cargo.toml— defines the available Cargo features and their dependenciesapp/src-tauri/tauri.conf.json— provides runtime configuration for enabled features
These files work together: Cargo.toml controls which code is compiled into the binary, while tauri.conf.json configures how those features behave at runtime.
Enabling Featured in Cargo.toml
Feature flags are declared in the [features] section of the shell's manifest. OpenHuman likely includes a default feature set that you can extend.
Structure of the Features Table
# app/src-tauri/Cargo.toml
[features]
# Base feature set that ships with the app
default = ["api"]
# Optional features you can enable individually
updater = ["tauri/updater"]
protocol = ["tauri/protocol"]
devtools = ["tauri/devtools"]
Each feature maps to a corresponding feature in the tauri crate. When you enable a feature, Cargo pulls in the additional dependencies and compiles the associated code.
Common Tauri Shell Features for OpenHuman
| Feature | Purpose | Required Config |
|---|---|---|
updater |
Automatic app updates | tauri.conf.json updater section |
protocol |
Custom URL scheme handler (e.g., openhuman://) |
tauri.protocols array |
devtools |
Web inspector for debugging | None (automatically available) |
api |
Core Tauri JavaScript API | Included in default |
Building with Specific Features
Once you've defined or selected features, rebuild the Tauri shell with those flags enabled.
Using Cargo Directly
# Build release binary with updater and protocol features
cargo build --release \
--manifest-path app/src-tauri/Cargo.toml \
--features "updater,protocol"
Using pnpm Scripts
OpenHuman provides convenience scripts that pass features through to Cargo:
# Development build with selected features
pnpm dev:app --features "updater,protocol"
# Production build
pnpm build:app --features "updater,protocol"
Verifying Feature Activation
After building, confirm your features are active:
- devtools: Press
Ctrl+Shift+I(Linux/Windows) orCmd+Option+I(macOS) to open the web inspector - updater: Check the application menu for "Check for Updates" or examine logs for updater initialization
- protocol: Register the protocol with your OS and test opening
openhuman://links
Configuring Enabled Features in tauri.conf.json
Some features require additional runtime configuration. The tauri.conf.json file controls how enabled features behave.
Configuring the Updater
{
"tauri": {
"updater": {
"active": true,
"endpoints": [
"https://api.openhuman.ai/releases/{{target}}/{{current_version}}"
],
"pubkey": "YOUR_PUBLIC_KEY_HERE",
"windows": {
"installMode": "passive"
}
}
}
}
Configuring a Custom Protocol
When the protocol feature is enabled, define the scheme and handler:
{
"tauri": {
"protocols": [
{
"scheme": "openhuman",
"handler": "src-tauri/src/protocol.rs"
}
]
}
}
Then implement the handler in app/src-tauri/src/protocol.rs:
use tauri::Manager;
pub fn handle_protocol<R: tauri::Runtime>(app: &tauri::AppHandle<R>, request: tauri::InvokePayload) {
// Handle openhuman:// URLs
if let Some(url) = request.body.as_str() {
println!("Received protocol request: {}", url);
// Route to appropriate application logic
}
}
Creating Composite Features
For complex builds, group multiple features together:
# app/src-tauri/Cargo.toml
[features]
default = ["api"]
# Individual features
updater = ["tauri/updater"]
protocol = ["tauri/protocol"]
devtools = ["tauri/devtools"]
# Composite feature for enterprise builds
enterprise = ["updater", "protocol", "tauri/system-tray"]
# Composite feature for development
dev = ["devtools", "protocol"]
Build with composite features the same way:
cargo build --release --features "enterprise"
Key Source Files Reference
| File | Path | Purpose |
|---|---|---|
| Shell manifest | app/src-tauri/Cargo.toml |
Feature definitions and crate dependencies |
| Runtime config | app/src-tauri/tauri.conf.json |
Feature behavior and window configuration |
| Library entry point | app/src-tauri/src/lib.rs |
Tauri command handlers and IPC bridge |
| Protocol handler | app/src-tauri/src/protocol.rs |
Custom URL scheme implementation (create if needed) |
| Build script | app/src-tauri/build.rs |
Pre-build configuration and code generation |
Summary
- Feature flags live in
app/src-tauri/Cargo.tomlunder the[features]table - Enable features by adding them to the default set or passing
--features "name"to cargo - Rebuild required: Feature selection happens at compile time, not runtime
- Configure behavior in
tauri.conf.jsonfor features that need runtime settings - Use composite features to simplify complex build configurations
Frequently Asked Questions
How do I check which features are currently enabled in my build?
Run cargo with the --verbose flag and examine the feature resolution output, or check the compiled binary's metadata with cargo tree -f "{p} {f}" in the app/src-tauri directory. The most reliable method is inspecting the Cargo.toml file before building.
Can I enable Tauri features without rebuilding the application?
No. Tauri features are compile-time flags that conditionally include code and dependencies. Changing features requires a full rebuild of the Rust binary. For runtime toggles, use Tauri's configuration system in tauri.conf.json or implement feature flags in your application logic.
What's the difference between tauri.conf.json and Cargo.toml features?
Cargo.toml features control what code gets compiled into the binary — they affect binary size and available APIs. tauri.conf.json controls how enabled features behave at runtime — URLs, window settings, and feature-specific options. Both are required: you must compile with the feature enabled, then configure it appropriately in the JSON file.
Have a question about this repo?
These articles cover the highlights, but your codebase questions are specific. Give your agent direct access to the source. Share this with your agent to get started:
curl -s "https://instagit.com/install.md" Maintain an open-source project? Get it listed too →