Seregon/StratoSDK

StratoSDK is a framework with a declarative approach similar to Flutter/React, written and designed entirely for Rust.

Rust/27.3 KB/No license
README.md
StratoSDK / README.md
1# StratoSDK 🦀
2 
3[![License: MIT/Apache-2.0](https://img.shields.io/badge/License-MIT%2FApache--2.0-blue.svg)](LICENSE)
4[![Rust](https://img.shields.io/badge/Rust-1.80%2B-orange.svg)](https://www.rust-lang.org)
5[![Platform](https://img.shields.io/badge/Platform-Windows%20%7C%20macOS%20%7C%20Linux%20%7C%20Web-green.svg)](https://github.com/StratoSDK/strato-ui)
6[![GitHub Sponsors](https://img.shields.io/github/sponsors/seregonwar?label=GitHub%20Sponsors&style=flat&logo=GitHub)](https://github.com/sponsors/seregonwar)
7 
8 
9**StratoSDK** is a next-generation, lightweight, secure, and reactive UI framework written in pure Rust. It combines the declarative programming model of Flutter/React with Rust's performance and safety guarantees, offering GPU-accelerated rendering for desktop applications and WebAssembly support for web deployment.
10 
11![Logo StratoSDK](https://github.com/StratoSDK/StratoSDK/raw/main/logos/StratoSDK-org.jpg)
12 
13## Features
14 
15- 🚀 **Pure Rust Implementation** - Zero unsafe code, leveraging Rust's safety guarantees
16- 🎨 **Declarative API** - Intuitive widget-based UI construction similar to Flutter/React
17- ⚡ **GPU Acceleration** - Hardware-accelerated rendering via wgpu (Vulkan/Metal/DirectX/WebGL)
18- 🌐 **Cross-Platform** - Native support for Windows, macOS, Linux, and WebAssembly
19- 🔄 **Reactive State Management** - Built-in signals and reactive primitives
20- 📦 **Lightweight** - Minimal dependencies and small binary size
21- 🎭 **Theming System** - Comprehensive theming with dark/light mode support
22- 🔥 **Hot Reload** - Fast development iteration (development mode)
23 
24## Architecture
25 
26StratoSDK follows a modular architecture with clear separation of concerns:
27 
28```
29strato-ui/
30├── strato-core/ # Core functionality (state, events, layout)
31├── strato-renderer/ # GPU rendering backend
32├── strato-widgets/ # UI component library
33├── strato-platform/ # Platform abstraction layer
34└── strato-macros/ # Procedural macros for better DX
35```
36 
37## Quick Start
38 
39### Prerequisites
40 
41- Rust 1.80+ (stable)
42- Platform-specific requirements:
43 - **Windows**: MSVC or MinGW
44 - **macOS**: Xcode Command Line Tools
45 - **Linux**: `build-essential`, `libxkbcommon-dev`
46 
47### Installation
48 
49Add StratoSDK to your `Cargo.toml`:
50 
51```toml
52[dependencies]
53strato-core = "0.1.0"
54strato-widgets = "0.1.0"
55strato-platform = "0.1.0"
56```
57 
58### Hello World Example
59 
60```rust
61use strato_widgets::prelude::*;
62use strato_platform::ApplicationBuilder;
63 
64fn main() {
65 ApplicationBuilder::new()
66 .title("Hello StratoSDK")
67 .run(build_ui())
68}
69 
70fn build_ui() -> impl Widget {
71 Container::new()
72 .padding(20.0)
73 .child(
74 Column::new()
75 .spacing(10.0)
76 .children(vec![
77 Box::new(Text::new("Hello, StratoSDK!")),
78 Box::new(Button::new("Click Me")
79 .on_click(|| println!("Clicked!"))),
80 ])
81 )
82}
83```
84 
85## 📚 Documentation
86 
87### Core Concepts
88 
89#### Widgets
90Widgets are the building blocks of StratoSDK applications. Every UI element is a widget with properties, state, and rendering logic.
91 
92```rust
93// Creating widgets
94let button = Button::new("Submit")
95 .style(ButtonStyle::primary())
96 .on_click(handle_submit);
97 
98let input = TextInput::new()
99 .placeholder("Enter your name...")
100 .on_change(|text| println!("Text: {}", text));
101```
102 
103#### Layout System
104StratoSDK uses a Flexbox-based layout system for arranging widgets:
105 
106```rust
107Row::new()
108 .spacing(10.0)
109 .main_axis_alignment(MainAxisAlignment::SpaceBetween)
110 .children(vec![...])
111 
112Column::new()
113 .cross_axis_alignment(CrossAxisAlignment::Center)
114 .children(vec![...])
115```
116 
117#### State Management
118Reactive state management with signals:
119 
120```rust
121use strato_core::state::Signal;
122 
123let count = Signal::new(0);
124 
125// Subscribe to changes
126count.subscribe(Box::new(|value| {
127 println!("Count changed to: {}", value);
128}));
129 
130// Update state
131count.set(42);
132```
133 
134#### Theming
135Comprehensive theming support:
136 
137```rust
138let theme = Theme::dark();
139ThemeProvider::new(theme)
140 .child(your_app_widget)
141```
142 
143## 🛠️ Development
144 
145### Building from Source
146 
147```bash
148# Clone the repository
149git clone https://github.com/StratoSDK/strato-ui.git
150cd strato-ui
151 
152# Build all crates
153cargo build --workspace
154 
155# Run tests
156cargo test --workspace
157 
158# Run examples
159cargo run --example hello_world
160cargo run --example counter
161```
162 
163### WebAssembly Build
164 
165```bash
166# Install wasm-pack
167cargo install wasm-pack
168 
169# Build for web
170wasm-pack build --target web crates/strato-platform
171 
172# Serve with a local server
173python -m http.server 8000
174```
175 
176## Roadmap
177 
178### Phase 1: Foundation ✅
179- [x] Core architecture
180- [x] Basic state management
181- [x] Event system
182- [x] Layout engine
183 
184### Phase 2: Rendering ✅
185- [x] wgpu integration
186- [x] Basic shape rendering
187- [x] Text rendering
188- [x] Texture management
189 
190### Phase 3: Widgets ✅
191- [x] Core widget system
192- [x] Basic widgets (Button, Text, Container)
193- [x] Layout widgets (Row, Column, Stack)
194- [x] Input widgets (TextInput)
195 
196### Phase 4: Platform
197- [x] Desktop support (Windows, macOS, Linux)
198- [x] WebAssembly support
199- [ ] Mobile support (future)
200 
201### Phase 5: Polish
202- [ ] Animation system
203- [ ] Advanced widgets
204- [ ] Visual designer
205- [ ] Plugin system
206 
207## Architecture Details
208 
209### Multi-Crate Structure
210 
211| Crate | Description | Key Features |
212|-------|-------------|--------------|
213| `strato-core` | Core functionality | State management, events, layout engine |
214| `strato-renderer` | GPU rendering | wgpu backend, texture atlas, text rendering |
215| `strato-widgets` | Widget library | Declarative widgets, theming, builders |
216| `strato-platform` | Platform layer | Window management, event loop, WASM support |
217| `strato-macros` | Procedural macros | Derive macros, DSL support |
218 
219### Performance Targets
220 
221- **Startup Time**: < 100ms
222- **Frame Time**: < 16.67ms (60 FPS minimum)
223- **Memory Usage**: < 50MB base
224- **WASM Size**: < 500KB compressed
225- **Layout Time**: < 1ms per 1000 widgets
226 
227## 🤝 Contributing
228 
229We welcome contributions! Please see our [Contributing Guide](CONTRIBUTING.md) for details.
230 
231### Development Setup
232 
2331. Fork the repository
2342. Create a feature branch (`git checkout -b feature/amazing-feature`)
2353. Commit your changes (`git commit -m 'Add amazing feature'`)
2364. Push to the branch (`git push origin feature/amazing-feature`)
2375. Open a Pull Request
238 
239## License
240 
241StratoSDK is dual-licensed under either:
242 
243- MIT License ([LICENSE-MIT](LICENSE.md))
244- Commercial license ([LICENSE-COMMERCIAL](COMMERCIAL.md))
245 
246at your option.
247 
248## Acknowledgments
249 
250- **wgpu** team for the excellent GPU abstraction
251- **winit** for cross-platform windowing
252- **lyon** for 2D graphics algorithms
253- **cosmic-text** for text rendering
254- The Rust community for amazing tooling and support
255 
256## Contact - (not yet available)
257 
258- **Website**: [StratoSDK.dev](https://StratoSDK.dev)
259- **GitHub**: [github.com/StratoSDK/strato-ui](https://github.com/StratoSDK/strato-ui)
260- **Discord**: [Join our community](https://discord.gg/StratoSDK)
261- **Twitter**: [@StratoHQ](https://twitter.com/StratoSDK)
262 
263## Examples
264 
265Check out our [examples](examples/) directory for more complete applications:
266 
267- [Hello World](examples/hello_world/) - Basic application structure
268<img width="373" height="516" alt="Screenshot 2025-12-15 alle 22 55 19" src="https://github.com/user-attachments/assets/800d2741-f65b-4023-b3eb-917a117f4d23" />
269 
270- [Counter](examples/counter/) - State management example
271<img width="462" height="394" alt="Screenshot 2025-12-15 alle 22 48 41" src="https://github.com/user-attachments/assets/c9803155-a17e-4f42-8876-e65b8a87a2bd" />
272 
273- [Modern Dashboard](examples/modern_dashboard/) - **New!** Comprehensive example featuring:
274 - Modular architecture (Views, Components)
275 - Multi-page navigation (Dashboard, Analytics, Users, Settings)
276 - Modern UI with responsive layout (Flexbox)
277 - Theming system
278 - Simulated backend integration
279 <img width="1552" height="987" alt="Screenshot 2025-12-15 alle 22 47 22" src="https://github.com/user-attachments/assets/3b8f3b3b-6191-4ad1-aee2-aacfc6d15efb" />
280 
281- [Todo App](examples/todo_app/) - Full CRUD application (coming soon)
282- [Calculator](examples/calculator/) - Complex layout example
283<img width="432" height="624" alt="Screenshot 2025-12-15 alle 22 46 42" src="https://github.com/user-attachments/assets/687f46d5-4d7b-49b6-93cd-9fc965b0c13f" />
284 
285 
286---
287 
288Built with ❤️ in Rust by the StratoSDK Team
289