bevyengine/bevy
API: the Bevy Remote Protocol (BRP)
The BRP is Bevy's external API surface. It is a JSON-RPC 2.0 interface that lets clients inspect and mutate a running Bevy app from outside the process — read entities, query components, spawn or despawn, modify components, register custom RPC methods.
This is the interface the Bevy editor prototypes use, the foundation any custom inspector tooling can build on, and a useful debugging surface for any Bevy game.
Implementation: bevy_remote.
Pages
| Page | What's covered |
|---|---|
| Protocol | The JSON-RPC envelope, methods, parameter shapes, error codes. |
Quick start
Add the plugin and HTTP transport:
use bevy::prelude::*;
use bevy::remote::{RemotePlugin, http::RemoteHttpPlugin};
App::new()
.add_plugins(DefaultPlugins)
.add_plugins(RemotePlugin::default())
.add_plugins(RemoteHttpPlugin::default())
.run();The HTTP listener defaults to 127.0.0.1:15702. Hit it with curl:
curl -s http://127.0.0.1:15702 \
-H 'Content-Type: application/json' \
-d '{"jsonrpc":"2.0","id":1,"method":"bevy/list"}'Standard methods
The crate-level rustdoc on bevy_remote is the authoritative list. Highlights:
| Method | Purpose |
|---|---|
bevy/list |
Enumerate entities or components. |
bevy/get |
Read components on an entity. |
bevy/query |
Run a query with filters. |
bevy/spawn |
Spawn an entity with components. |
bevy/despawn |
Despawn entities. |
bevy/insert / bevy/remove |
Add or remove components. |
bevy/registry/schema |
JSON-schema for a reflected type. |
bevy/get+watch / bevy/list+watch |
Long-poll subscriptions. |
Custom methods
fn handler(In(params): In<Value>, world: &mut World) -> BrpResult {
// ... do work, produce a JSON Value
Ok(serde_json::json!({"ok": true}))
}
app.register_remote_method("my/custom/method", handler);User code can plug in arbitrary RPC handlers. The protocol stays JSON-RPC; only the dispatch table grows.
Where to use the BRP
- In-game debugging: spawn / despawn / mutate components without restarting.
- Editor tooling: the BRP is the on-the-wire format the editor talks to a running game over.
- External inspectors: build a process or web page that reads game state without a Rust dependency.
- CI / automation: drive a Bevy app for testing.
What it's not
- Not a public, stable API for end users. The BRP exposes internals, including reflection paths that can change between Bevy minor releases. Tools should declare a Bevy-version compatibility range.
- Not authenticated. The default HTTP transport binds only to localhost. Don't expose it to the public internet.
- Not high-throughput. It's tuned for tools and debugging, not real-time game traffic.
See also
bevy_remote— implementation tour.bevy_reflect— drives serialization of component values.- Protocol — wire-format details.
Built by Factory AutoWiki from public repository content. It is a generated preview for codebase exploration, not source-maintained documentation.