Impl-First Design
Write your business logic once as Rust methods. Derive protocol handlers automatically.
Write your implementation once, project it into multiple protocols
use server_less::prelude::*;
struct UserService { /* ... */ }
#[http(prefix = "/api")]
#[cli(name = "users")]
#[mcp(namespace = "users")]
#[ws(path = "/ws")]
impl UserService {
/// Create a new user
pub async fn create_user(&self, name: String, email: String) -> Result<User, UserError> {
// your implementation
}
/// Get user by ID
pub async fn get_user(&self, id: String) -> Option<User> {
// your implementation
}
}This generates:
POST /api/users, GET /api/users/{id} + OpenAPI specusers create-user --name X --email Yusers_create_user, users_get_userGenerate working server implementations:
#[http] - REST/HTTP with Axum + OpenAPI ✅ Production Ready#[cli] - Command-line with Clap ✅ Production Ready#[mcp] - Model Context Protocol ✅ Production Ready#[ws] - WebSocket JSON-RPC 2.0 ✅ Stable#[jsonrpc] - Standalone JSON-RPC ✅ Stable#[graphql] - GraphQL schema + resolvers ✅ Working*Generate IDL/schema files:
#[grpc] - Protocol Buffers .proto files#[capnp] - Cap'n Proto .capnp schemas#[thrift] - Apache Thrift .thrift IDL#[smithy] - AWS Smithy .smithy models#[connect] - Connect RPC schemasGenerate API documentation:
#[openrpc] - OpenRPC specs (JSON-RPC docs)#[asyncapi] - AsyncAPI specs (WebSocket/messaging)#[jsonschema] - JSON Schema definitions#[markdown] - Human-readable API docsBatteries-included shortcuts:
#[server] → #[http] + #[serve(http)]#[rpc] → #[jsonrpc] + #[openrpc] + #[serve(jsonrpc)]#[tool] → #[mcp] + #[jsonschema]#[program] → #[cli] + #[markdown]#[derive(ServerlessError)] - Error code inference + HTTP status mapping#[serve] - Compose multiple protocol routers#[route] - Per-method HTTP overrides#[param] - Per-parameter cross-protocol customizationCurrent: v0.2.0 ✅
#[server], #[rpc], #[tool], #[program]--json, --jq, --output-schemaSee TODO.md for the backlog.
Server-less follows four core principles:
#[derive(Server)]Read more: Impl-First Design
Server-less is part of the RHI ecosystem - tools for building composable systems.
Related projects:
#[param] cross-protocol customization[dependencies]
# Get everything (recommended for getting started)
server-less = "0.2"
# Or select specific features
server-less = { version = "0.2", default-features = false, features = ["http", "cli", "mcp"] }Contributions welcome! See CLAUDE.md for development guidelines.
MIT License - see LICENSE for details.