🚀 WebRust — Python Meets Rust Meets Web
The Revolutionary Framework Bridging Two Ecosystems
🔥 Write like Python. Run like Rust. Deploy as Web. Zero configuration.
Documentation | Examples | Crates.io
🌟 Why WebRust? A Manifesto for 2025
The Great Divide in Programming
The programming world is split between two philosophies:
Python's camp says: "Life is short, use Python" — prioritizing developer happiness, rapid prototyping, and readable syntax.
Rust's camp says: "Performance and safety first" — prioritizing zero-cost abstractions, memory safety, and compile-time guarantees.
WebRust's answer: "Why choose? Have both."
Why We're Still Stuck in the Console in 2025
It's 2025. We have:
- 🚀 Blazingly fast computers with multi-core processors
- 🎨 Beautiful displays with millions of colors
- 🌐 Universal web browsers on every device
- 🧠 AI models running in real-time
Yet most educational tools, data analysis scripts, and prototypes still output to a monochrome terminal window invented in the 1970s.
Why? Because creating a proper GUI requires:
- Learning HTML/CSS/JavaScript (separate skillset)
- Managing web servers and deployment
- Writing boilerplate for state management
- Dealing with frontend/backend separation
WebRust's philosophy: Your code is the interface. The browser is your canvas. Forget the terminal.
A Bridge Between Two Worlds
WebRust isn't just a library — it's a proposal for the future of programming languages:
- Syntax Evolution: Languages should embrace ergonomics without sacrificing performance
- Ecosystem Integration: Python developers should feel at home in Rust, and vice versa
- Modern Defaults: In 2025, the default output shouldn't be plain text — it should be styled, interactive, and visual
- Zero-Configuration Philosophy: Great tools should work out of the box
WebRust proves these aren't mutually exclusive goals. You can have Python's elegance with Rust's speed, running in a modern web interface, with zero setup.
🎯 The Problem: Three Painful Paths
Path 1: Terminal Applications (1970s Technology)
use io;
println!
Reality Check:
- ❌ No colors, no styling, no interactivity
- ❌ Can't embed charts, tables, or visualizations
- ❌ No mathematical notation support
- ❌ Copy-paste is painful
- ❌ Screenshots look unprofessional
In 2025, this is like using a typewriter when you have a smartphone.
Path 2: Web Frameworks (Complexity Explosion)
use *;
Reality Check:
- ❌ Need to learn 3 languages (HTML/CSS/JS)
- ❌ Separate frontend and backend logic
- ❌ State management becomes complex
- ❌ Deployment requires infrastructure
- ❌ Just wanted to print styled text!
In 2025, this is like building a car when you just want to go to the store.
Path 3: Desktop GUI Frameworks (Framework Lock-in)
use egui;
Reality Check:
- ❌ Learn framework-specific APIs
- ❌ Platform-specific quirks
- ❌ Distribution is complicated
- ❌ Can't easily share via URL
- ❌ Updates require reinstalling
In 2025, this is like building native apps when the web exists.
✨ The WebRust Solution: Elegance Meets Power
Same Problem, WebRust Way
use *;
What Just Happened?
✅ Python-like syntax — 0.to(10), .when()/.then(), .splitby()
✅ Styled output — Colors, fonts, positions with chainable API
✅ Type-safe inputs — Real-time validation in the browser
✅ Automatic web UI — Browser opens, server runs, zero config
✅ Rust performance — Compiles to native code, runs blazingly fast
Run it: cargo run → Browser opens automatically with a beautiful, styled interface.
🧩 Core Philosophy: Python Ergonomics in Rust
WebRust demonstrates that systems languages can be ergonomic without sacrificing safety or performance.
1. Python-like Ranges
# use *;
#
2. List & Dictionary Comprehensions
# use *;
use HashMap;
#
The beauty: These compile to standard Rust iterators — zero runtime cost!
3. Python String Methods
# use *;
#
One method (splitby) handles all split patterns — delimiter, whitespace, lines — just like Python!
4. F-String Interpolation
# use *;
#
Processed at compile-time — no runtime overhead!
📊 Beyond Text: Modern Visualizations
Interactive Charts (ECharts Integration)
# use *;
use HashMap;
#
9+ chart types: line, bar, pie, doughnut, radar, area, scatter, gauge, funnel, heatmap, candlestick, bubble.
Smart Tables (From Any Data)
# use *;
use HashMap;
#
Turtle Graphics & Animations
# use *;
#
20+ easing functions: linear, sine, quad, cubic, elastic, bounce, back, expo, etc.
🆕 Physics-based animations: Synchronize rotation with translation for realistic rolling motion!
🏗️ Architecture: How It Works
The #[gui] Macro Magic
When you write:
# use *;
WebRust automatically:
- Transforms f-strings at compile-time (
{var}→format!()) - Starts HTTP server on
127.0.0.1:8080 - Opens browser automatically
- Serves modern UI with MathJax, ECharts, D3.js
- Handles bidirectional communication (Rust ↔ JavaScript)
- Auto-shuts down when browser closes (3s timeout)
You write Python-like Rust. WebRust handles the web.
Zero-Cost Abstractions
# use *;
#
All Python-like syntax is compile-time sugar — no runtime overhead!
Type-Safe Everything
# use *;
#
Validation happens twice:
- Client-side (JavaScript) — Immediate feedback in browser
- Server-side (Rust) — Type-safe parsing with helpful errors
🎨 Professional Styling Out of the Box
Inline Color Syntax
# use *;
#
CSS-Inspired Chainable API
# use *;
#
Grid-Based Layouts
# use *;
#
Build dashboards in minutes, not hours.
🌍 Real-World Use Cases
1. Education & Teaching
# use *;
Perfect for: Math education, algorithm visualization, interactive textbooks.
2. Data Analysis & Reporting
# use *;
use HashMap;
Perfect for: Business reports, data exploration, executive dashboards, scientific papers.
🆕 NEW: Grid system makes professional multi-panel layouts trivial!
3. Scientific Computing
# use *;
Perfect for: Physics simulations, chemistry visualizations, biology models, astronomy.
🆕 NEW: Hierarchical groups enable complex multi-body systems with realistic physics!
4. Prototyping & Demos
# use *;
**Perfect for**: Customer demos, proof-of-concepts, hackathons.
---
<a id="getting-started"></a>
<a id="sec-getting-started"></a>
## 🚀 **Getting Started**
### **Installation**
```toml
[dependencies]
webrust = \"1.2.0\"
Your First App (30 seconds)
use *;
Run: cargo run → Browser opens → Professional UI appears.
📚 Rich Examples
WebRust includes comprehensive examples demonstrating every feature:
Each example is extensively commented and demonstrates best practices.
🆕 Don't miss py_mixed: Shows the full power of the 1.2.0 layout system with a 3×3 grid containing tables, charts, LaTeX, and complex hierarchical animations (like bouncing balls with physics)!
🎯 WebRust's Vision for Programming's Future
1. Syntax Should Be Universal
Good ideas shouldn't be language-specific. If Python's range(10) is intuitive, why can't Rust have 0.to(10)? If JavaScript's template literals work, why not Rust's {variable}?
WebRust proves syntax can evolve without breaking performance or safety.
2. Ecosystems Should Talk
Python developers bring 30 years of ergonomic patterns. Rust brings safety and speed. These communities should learn from each other, not stay isolated.
WebRust builds bridges, not walls.
3. Defaults Should Be Modern
In 2025, "Hello, World!" shouldn't be monochrome terminal text. It should be:
- ✅ Styled (colors, fonts, layouts)
- ✅ Interactive (inputs, buttons, charts)
- ✅ Shareable (runs in browser, URL-accessible)
- ✅ Visual (supports math, graphics, animations)
WebRust makes the modern default effortless.
4. Complexity Should Be Optional
Want to make a simple script? Use println().
Want to add styling? Chain .color().
Want a chart? Call chart().
Want animations? Add .ease().
Each layer of complexity is opt-in, not mandatory.
🔮 What's Next?
WebRust is actively evolving with:
- 🎨 More chart types (sankey, treemap, 3D plots)
- 🧩 Component system (reusable UI widgets)
- 🌐 Static export (generate standalone HTML)
- 📱 Mobile optimization (responsive by default)
- 🔌 Plugin ecosystem (community extensions)
- 🌍 i18n support (multi-language UIs)
Join us in reimagining what programming can be.
🤝 Contributing
WebRust welcomes contributions! Whether you:
- 🐛 Found a bug → Open an issue
- 💡 Have an idea → Start a discussion
- 📝 Want to improve docs → PRs welcome!
- 🎨 Built something cool → Share it
Community principles:
- Keep it Pythonic (readable, intuitive)
- Keep it Rusty (safe, fast, expressive)
- Keep it simple (zero-config, batteries-included)
📄 License
MIT License — see LICENSE for details.
🙏 Acknowledgments
WebRust stands on the shoulders of giants:
- Python community — For showing us ergonomics matter
- Rust community — For proving safety and speed coexist
- Web standards — For creating the universal platform
- Open source — For enabling collaboration
Special thanks to the creators of:
- tiny_http — Simple HTTP server
- serde — Serialization framework
- MathJax — Beautiful math rendering
- ECharts — Powerful charting library
- Two.js — 2D drawing API
🌟 The Bottom Line
It's 2025. We have the technology to make programming:
- More intuitive (Python-like syntax)
- More safe (Rust's type system)
- More visual (browser-based UIs)
- More accessible (zero configuration)
WebRust proves it's possible. We're not asking you to choose between Python and Rust, between simplicity and performance, between terminal and web.
We're showing you can have it all.
🦀 Write Python. Think Rust. Ship Web. 🌐
Get Started Now | View Examples | Join Discussion
Made with ❤️ for developers who believe programming should be joyful