rabbitmesh 0.1.1

Message-driven microservices framework using RabbitMQ for zero-port service mesh
Documentation

RabbitMesh Logo

RabbitMesh

Zero-Port Microservices Framework

Write business logic, get REST + GraphQL APIs automatically

Crates.io Documentation GitHub License


RabbitMesh eliminates traditional microservice complexity by using RabbitMQ for all inter-service communication. Write business logic, get REST + GraphQL APIs automatically.

✨ Key Features

  • πŸ”₯ Zero Port Management - Services only connect to RabbitMQ
  • ⚑ Never Blocks - Every request spawns async task
  • 🎯 Auto-Generated APIs - Write service methods, get REST + GraphQL
  • 🎭 Universal Macros - 50+ macros for auth, caching, validation, metrics
  • πŸ›‘οΈ Production Ready - Built-in retries, timeouts, load balancing
  • 🌍 Deploy Anywhere - Docker, Kubernetes, bare metal

πŸ“š Documentation

πŸš€ Quick Start

1. Define Your Service

use rabbitmesh_macros::{service_definition, service_method};

#[service_definition]
pub struct UserService;

impl UserService {
    #[service_method("GET /users/:id")]
    pub async fn get_user(user_id: u32) -> Result<User, String> {
        // Your business logic only
        Ok(User { id: user_id, name: "John".to_string() })
    }
    
    #[service_method("POST /users")]  
    pub async fn create_user(data: CreateUserRequest) -> Result<User, String> {
        // Handle user creation
        Ok(User { id: 1, name: data.name })
    }
}

2. Start Your Service

use rabbitmesh::MicroService;

#[tokio::main]
async fn main() -> Result<(), Box<dyn std::error::Error>> {
    let service = MicroService::new("amqp://localhost:5672").await?;
    service.start().await?;  // Never blocks, handles requests concurrently
    Ok(())
}

3. Auto-Generated API Gateway

use rabbitmesh_gateway::create_auto_router;

#[tokio::main] 
async fn main() {
    let app = create_auto_router().await;
    
    // Automatically provides:
    // GET  /api/v1/user-service/users/123
    // POST /api/v1/user-service/users
    // GraphQL endpoint at /graphql
    
    axum::Server::bind(&"0.0.0.0:3000".parse().unwrap())
        .serve(app.into_make_service())
        .await
        .unwrap();
}

πŸ—οΈ Architecture

β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”    β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”    β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
β”‚   Frontend  │────│ API Gateway │────│        Service Mesh             β”‚
β”‚  (NextJS)   β”‚HTTPβ”‚ (Auto-Gen)  β”‚AMQPβ”‚  β”Œβ”€β”€β”€β”€β”€β” β”Œβ”€β”€β”€β”€β”€β” β”Œβ”€β”€β”€β”€β”€β”      β”‚
β”‚             β”‚    β”‚             β”‚    β”‚  β”‚User β”‚ β”‚Auth β”‚ β”‚Orderβ”‚ ...  β”‚
β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜    β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜    β”‚  β””β”€β”€β”€β”€β”€β”˜ β””β”€β”€β”€β”€β”€β”˜ β””β”€β”€β”€β”€β”€β”˜      β”‚
                                      β”‚           β”‚                    β”‚
                                      β”‚     β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”            β”‚
                                      β”‚     β”‚  RabbitMQ   β”‚            β”‚
                                      β”‚     β”‚   Broker    β”‚            β”‚
                                      β””β”€β”€β”€β”€β”€β”΄β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”΄β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜

πŸ“¦ Crates

  • rabbitmesh - Core microservice framework
  • rabbitmesh-macros - Code generation macros
  • rabbitmesh-gateway - Auto-generating API gateway
  • examples/ecommerce - Complete demo application

🎯 Why RabbitMesh?

Traditional HTTP RabbitMesh
❌ Port management hell βœ… Zero ports to manage
❌ Manual load balancing βœ… Automatic via RabbitMQ
❌ Service discovery complexity βœ… Auto-discovery via queues
❌ Blocking request handlers βœ… Every request is async
❌ Manual API development βœ… Auto-generated REST + GraphQL

πŸš€ Performance

  • Latency: 3-10ms (vs 1-5ms HTTP direct)
  • Throughput: Higher than HTTP (persistent connections)
  • Concurrency: Unlimited (every request = async task)
  • Scalability: Linear (add instances = proportional capacity)

πŸ“‹ Getting Started

See the examples/simple-todo directory for a complete working example, or use our AI agent to create new projects:

# Install the AI agent and create a new project
python3 rabbitmesh_agent.py create my-awesome-service

🀝 Contributing

We welcome contributions! Please see our Contributing Guide for details.

πŸ“„ License

MIT license. See LICENSE for details.


RabbitMesh Logo

Built with ❀️ by the RabbitMesh Team

πŸ¦€ Crates.io β€’ πŸ“š Docs β€’ πŸ™ GitHub β€’ πŸ’¬ Discussions

The future of microservices is here - zero ports, maximum power, pure elegance ✨