Bevy Webgate
A web server integration for the Bevy game engine that allows you to easily append a webserver to Bevy. For either creating standalone webapps or appending a webserver to an existing bevy app/game.
Features
- 🚀 Seamless integration with Bevy ECS
- 🌐 Built on top of Axum for all your webserver needs
- ⚡ Async-first design with full ECS access thanks to bevy_defer
- 🔧 Multi-port support - Run multiple servers on different ports
- 🏠 IP binding control - Bind servers to specific IP addresses
Installation
Add this to your Cargo.toml:
[]
= "0.2.0"
= "0.17"
= "0.8.1"
Quick Start
Here's a minimal example that sets up a simple "Hello World" web server:
use *;
use RouterAppExt;
async
Usage Guide
Basic Setup
- Use the
RouterAppExttrait to add routes - Define your handler functions
- That's it! Your web server is ready to go
use *;
use RouterAppExt;
Multi-Port Support
Run multiple web servers on different ports within a single Bevy application:
use *;
use *;
For more details on multi-port functionality, see docs/multi_port.md.
Accessing Bevy ECS from Handlers
The plugin uses bevy_defer::AsyncWorld for accessing Bevy's ECS from your web handlers:
use AsyncWorld;
async
Template Integration with Maud
Create dynamic HTML templates using my recommendation, Maud:
use ;
async
HTMX Integration
The plugin works great with HTMX for dynamic content:
async
Versions
| bevy | bevy_webgate |
|---|---|
| 0.16 | 0.1 |
| 0.17 | 0.2 |
Examples
There is a complete example of a web-based game score tracker in examples/crud_app.rs
This also uses another one of my crates bevy_easy_database which makes it easy to persist data!
Contributing
Contributions are welcome! Please feel free to submit a Pull Request.
License
MIT OR Apache-2.0
Credits
Built with ❤️ for the Bevy community. Built off the back of Axum and bevy_defer