tauri-plugin-steamworks-api
v0.1.0
Published
Full [Steamworks SDK](https://partner.steamgames.com/doc/sdk) integration for [Tauri](https://tauri.app) v2 — **usable entirely from JavaScript** without writing Rust code.
Readme
tauri-plugin-steamworks
Full Steamworks SDK integration for Tauri v2 — usable entirely from JavaScript without writing Rust code.
Features
| Module | API |
|---|---|
| Init | init(appId), shutdown(), isRunning() |
| User | getUserId(), getUserName(), getUserLevel(), getUserAvatar() |
| Friends | getFriends(), getFriendCount(), getFriendGame(), requestUserInformation() |
| Overlay | activateGameOverlay(), activateGameOverlayToWebPage(), activateGameOverlayToStore(), isOverlayEnabled(), isOverlayActive() |
| Overlay Surface | activateOverlay(), setupOverlayForwarding() — Shift+Tab support via tauri-plugin-steam-overlay-surface (feature-gated) |
| Achievements | setAchievement(), clearAchievement(), getAchievement(), getAchievements(), getAchievementIcon(), getNumAchievements() |
| Stats | setStatInt(), setStatFloat(), getStatInt(), getStatFloat(), storeStats(), resetAllStats() |
| Rich Presence | setRichPresence(), clearRichPresence(), getRichPresence() |
| Leaderboards | findOrCreateLeaderboard(), findLeaderboard(), uploadScore(), downloadScores(), getLeaderboardEntryCount() |
| Lobbies | createLobby(), joinLobby(), leaveLobby(), getLobbyData(), setLobbyData(), getLobbyMembers(), getLobbyMemberData(), setLobbyType(), setLobbyJoinable() |
| Input | getNumAttachedDevices(), getControllerBindingConfiguration(), isUsingSteamInput(), activateActionSet(), getAnalogActionData(), getDigitalActionData() |
| Remote Storage | getFileCount(), fileExists(), getFileSize(), fileWrite(), fileRead(), fileDelete() |
| UGC/Workshop | getUgcNumSubscribedItems(), getUgcSubscribedItem(), updatePublishedFile(), createQueryUgc() |
| Screenshots | takeScreenshot(), isScreenshotHooked() |
| Utils | getAppId(), getUiLanguage(), getIpCountry(), getSystemTime(), getSecondsSinceAppActive() |
| Auth | sendAuthSessionTicket(), getAuthTicketForWebApi(), cancelAuthTicket(), beginAuthenticationSession(), endAuthenticationSession() |
Prerequisites
- Steamworks SDK — place
steam_api64.dll(Windows) /libsteam_api.so(Linux) /libsteam_api.dylib(macOS) next to your binary - Steam client running — the plugin requires the Steam client to be active
- Valid AppID — your Steam App ID (not Spacewar 480 for production)
Installation
1. Rust crate
cd src-tauri
cargo add tauri-plugin-steamworksOr manually in src-tauri/Cargo.toml:
[dependencies]
tauri-plugin-steamworks = "0.1"With overlay (Shift+Tab) support:
[dependencies]
tauri-plugin-steamworks = { version = "0.1", features = ["overlay"] }If you use the plugin from a local path (monorepo / development):
[dependencies]
tauri-plugin-steamworks = { path = "../tauri-plugin-steamworks", features = ["overlay"] }2. Tauri plugin registration
In src-tauri/src/lib.rs:
pub fn run() {
tauri::Builder::default()
.plugin(tauri_plugin_steamworks::init())
.run(tauri::generate_context!())
.expect("error while running tauri application");
}With overlay (Shift+Tab) support, chain the overlay plugin:
pub fn run() {
tauri::Builder::default()
.plugin(tauri_plugin_steamworks::init())
.plugin(tauri_plugin_steamworks::init_overlay())
.run(tauri::generate_context!())
.expect("error while running tauri application");
}3. JavaScript/TypeScript package
npm install tauri-plugin-steamworks-apiOr point directly to the guest-js/ folder.
4. Permissions
In src-tauri/capabilities/default.json, add:
{
"permissions": [
"steamworks:default"
]
}Usage (JavaScript)
import * as Steam from 'tauri-plugin-steamworks-api'
// Initialize Steam (call once on app start)
await Steam.init(480) // your App ID
// Check if running
console.log('Steam running:', await Steam.isRunning())
// User info
const userId = await Steam.getUserId()
const name = await Steam.getUserName()
const level = await Steam.getUserLevel()
// Friends
const friends = await Steam.getFriends()
console.log(friends)
// Achievements
await Steam.setAchievement('FIRST_BLOOD')
const achievements = await Steam.getAchievements()
// Rich Presence
await Steam.setRichPresence('status', 'In Main Menu')
await Steam.setRichPresence('steam_display', '#StatusMenu')
// Leaderboards
const lb = await Steam.findOrCreateLeaderboard('Score', 1, 1, 10)
await Steam.uploadScore('Score', 12345, 1)
// Lobbies
const lobby = await Steam.createLobby(3, 4) // Public, 4 players
await Steam.setLobbyData(lobby.lobbyId, 'name', 'My Lobby')
const members = await Steam.getLobbyMembers(lobby.lobbyId)
// Overlay
await Steam.activateGameOverlay('friends')
await Steam.activateGameOverlayToWebPage('https://example.com')
// Cloud saves
await Steam.fileWrite('save.json', Array.from(new TextEncoder().encode(JSON.stringify({score: 100}))))
const data = await Steam.fileRead('save.json')
// Stats
await Steam.setStatInt('kills', 42)
const kills = await Steam.getStatInt('kills')
// Screenshots
await Steam.takeScreenshot()
// Shutdown when done
await Steam.shutdown()Architecture
┌──────────────────────────────────────────────────────────────────┐
│ JavaScript (frontend) │
│ import * as Steam from 'tauri-plugin-steamworks-api' │
│ │
│ Steam.init(480) → invoke('plugin:steamworks|steam_init', ...) │
└─────────────────────────────┬────────────────────────────────────┘
│ Tauri IPC
┌─────────────────────────────▼────────────────────────────────────┐
│ Rust plugin (tauri-plugin-steamworks) │
│ │
│ Static STEAM_CLIENT (Mutex<Option<steamworks::Client>>) │
│ Background thread: callback pump (100ms interval) │
│ │
│ All commands access the static client directly │
│ No state management, no AppHandle dependency │
└──────────────────────────────────────────────────────────────────┘
│
┌─────────────────────────────▼────────────────────────────────────┐
│ steamworks-rs → Steamworks SDK (steam_api64.dll) │
└──────────────────────────────────────────────────────────────────┘Important Notes
- Overlay (Shift+Tab): Enable the
overlayfeature to get built-in Shift+Tab support via tauri-plugin-steam-overlay-surface. This creates a transparent decoy swapchain that Steam hooks into. In your frontend, callsetupOverlayForwarding()afterinit()to forward Shift+Tab to Steam:import { init, setupOverlayForwarding } from 'tauri-plugin-steamworks-api' await init(480) setupOverlayForwarding() - Thread safety: The plugin uses a background thread for Steam callbacks. All Tauri commands access the client via
Mutex. - Windows:
steam_api64.dllmust be next to your.exe. Get it from the Steamworks SDKredistributable_bin/folder. - Linux:
libsteam_api.somust be in the library path or next to the binary.
Limitations
- Achievement notification toasts: Steam's visual "Achievement Unlocked" popup plays its sound but does not display visually. This is a limitation of the overlay surface approach: the decoy swapchain window is hidden when the overlay is closed, so Steam cannot composite notification toasts onto it. The sound still plays, confirming the achievement was processed.
- Windows only (overlay surface): The
overlayfeature relies on tauri-plugin-steam-overlay-surface, which creates a decoy swapchain (D3D11) that Steam hooks for Shift+Tab. This only works on Windows. On Linux, Steam usesgameoverlayrenderer.sowith Vulkan/OpenGL hooks, plus X11/Wayland-specific window management — the approach should translate but requires platform-specific work upstream. On macOS, Metal support would be needed and Steam overlay is largely non-functional natively. The upstream repo accepts PRs for cross-platform support. - Steam client required: The plugin cannot work without a running Steam client. There is no offline/mock mode.
steam_api64.dllplacement: The Steamworks shared library must be placed next to your binary manually. It is not bundled by the plugin.- Thread safety: The plugin uses a background thread for Steam callbacks. All commands lock a global
Mutex, so heavy concurrent access from the frontend could cause brief contention. - Alpha: This project is AI-assisted and early stage. APIs may change. Test thoroughly before shipping.
Warning
This project was generated with the assistance of AI. It is in an early/alpha stage and may contain bugs, incomplete implementations, or APIs that change without notice. Use it at your own risk and test thoroughly before relying on it in production. Contributions and bug reports are welcome.
Credits
- steamworks-rs — Rust bindings for the Steamworks SDK
- tauri-plugin-steam-overlay-surface — Steam overlay (Shift+Tab) support for Tauri via a transparent decoy swapchain (by PSG Studios)
- tauri-plugin-drpc — Reference for the guest-js plugin pattern
- Tauri — The app framework
License
MIT
