Skip to content

Commit a2c099e

Browse files
committed
!
1 parent 9f09972 commit a2c099e

1 file changed

Lines changed: 95 additions & 0 deletions

File tree

README.md

Lines changed: 95 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,95 @@
1+
<div align="center">
2+
<img src="assets/logo.jpg" alt="RustAPI Logo" width="200" height="200" />
3+
<h1>RustAPI</h1>
4+
<p>
5+
<strong>The Ergonomic Web Framework for Rust.</strong><br>
6+
Built for Developers, Optimised for Production.
7+
</p>
8+
9+
[![License](https://img.shields.io/badge/license-MIT%2FApache--2.0-blue.svg)](LICENSE)
10+
[![Rust](https://img.shields.io/badge/rust-1.75%2B-orange.svg)](https://www.rust-lang.org/)
11+
[![Status](https://img.shields.io/badge/status-active-green.svg)](https://github.com/RustAPI/RustAPI)
12+
</div>
13+
14+
<br />
15+
16+
## 🚀 Vision
17+
18+
**RustAPI** brings the developer experience (DX) of modern frameworks like **FastAPI** to the **Rust** ecosystem.
19+
20+
We believe that writing high-performance, type-safe web APIs in Rust shouldn't require fighting with complex trait bounds or massive boilerplate. RustAPI provides a polished, battery-included experience where:
21+
22+
* **API Design is First-Class**: Define your schema, and let the framework handle Validation and OpenAPI documentation automatically.
23+
* **The Engine is Abstracted**: We rely on industry standards like `tokio`, `hyper`, and `matchit` internally, but we expose a stable, user-centric API. This means we can upgrade the engine without breaking your code.
24+
* **Zero Boilerplate**: Extractors and macros do the heavy lifting.
25+
26+
## ✨ Features
27+
28+
- **⚡ Fast & Async**: Built on top of `tokio` and `hyper` 1.0.
29+
- **🛡️ Type-Safe**: Request/Response bodies are strictly typed using generic extractors (`Json`, `Query`, `Path`).
30+
- **📝 Automatic OpenAPI**: Your code *is* your documentation. Swagger UI is served at `/docs` out of the box.
31+
- **✅ Built-in Validation**: Add `#[validate(email)]` to your structs and get automatic 422 error handling.
32+
- **🧩 Intuitive Routing**: Radix-tree based routing with simple macros `#[rustapi::get]`, `#[rustapi::post]`.
33+
- **🔋 Batteries Included**: Tracing, graceful shutdown, state management, and error handling are pre-configured.
34+
35+
## 📦 Quick Start
36+
37+
Add `rustapi-rs` to your `Cargo.toml`.
38+
39+
```rust
40+
use rustapi_rs::prelude::*;
41+
42+
/// Define your response schema
43+
#[derive(Serialize, Schema)]
44+
struct HelloResponse {
45+
message: String,
46+
}
47+
48+
/// Define an endpoint
49+
#[rustapi::get("/")]
50+
#[rustapi::tag("General")]
51+
#[rustapi::summary("Hello World Endpoint")]
52+
async fn hello() -> Json<HelloResponse> {
53+
Json(HelloResponse {
54+
message: "Hello from RustAPI!".to_string(),
55+
})
56+
}
57+
58+
/// Run the server
59+
#[rustapi::main]
60+
async fn main() -> Result<()> {
61+
RustApi::new()
62+
.mount_route(hello_route()) // Auto-generated route handler
63+
.docs("/docs") // Enable Swagger UI
64+
.run("127.0.0.1:8080")
65+
.await
66+
}
67+
```
68+
69+
Visit `http://127.0.0.1:8080/docs` to see your interactive API documentation!
70+
71+
## 🏗️ Architecture
72+
73+
RustAPI follows a **Facade Architecture** to ensure long-term stability:
74+
75+
* **`rustapi-rs`**: The public-facing crate. It re-exports carefully selected types and traits to provide a clean surface.
76+
* **`rustapi-core`**: The internal engine. Handles the HTTP protocol, routing logic, and glue code.
77+
* **`rustapi-macros`**: Powers the ergonomic attributes like `#[rustapi::main]` and `#[rustapi::get]`.
78+
* **`rustapi-openapi` / `rustapi-validate`**: Specialized crates that wrap external ecosystems (`utoipa`, `validator`) into our consistent API.
79+
80+
## 🗺️ Roadmap
81+
82+
- [x] **Phase 1: MVP**: Core routing, extractors, and server.
83+
- [x] **Phase 2: Validation & OpenAPI**: Auto-docs, strict validation, and metadata.
84+
- [ ] **Phase 3: Batteries Included**: Authentication (JWT), CORS, Rate Limiting, and Middleware.
85+
- [ ] **Phase 4: v1.0 Polish**: Advanced ergonomics, CLI tool, and production hardening.
86+
87+
88+
## 📄 License
89+
90+
This project is licensed under either of
91+
92+
* Apache License, Version 2.0
93+
* MIT license
94+
95+
at your option.

0 commit comments

Comments
 (0)