A flexible MQTT routing framework with middleware support
Project description
RouteMQ Framework
A flexible MQTT routing framework with middleware, dynamic routes, queue workers, Redis integration, and horizontal scaling — inspired by Laravel/Django web frameworks.
Quick Start
1. Install
pip install routemq[cli]
2. Scaffold a new project
routemq new my-app
cd my-app
The scaffolder asks about optional features (MySQL, Redis, background queue, Docker). Use --yes to accept defaults non-interactively.
3. Run
# Edit .env with your MQTT broker details
routemq run
Features
- Dynamic Router Loading - Automatically discover and load routes from multiple files
- Route-based MQTT topic handling - Define routes for MQTT topics
- Middleware support - Process messages through middleware chains
- Parameter extraction - Extract variables from MQTT topics using Laravel-style syntax
- Background Task Queue - Laravel-style queue system for async job processing
- Shared Subscriptions - Horizontal scaling with worker processes
- Redis Integration - Optional Redis support for distributed caching and rate limiting
- Advanced Rate Limiting - Multiple rate limiting strategies with Redis backend
- Optional MySQL integration - Use with or without a database
- Docker Support - Production-ready Docker Compose setup with queue workers
- Environment-based configuration - Configuration through .env files
Documentation
Documentation is available in the docs folder, optimized for GitBook integration.
See the Installation Guide for detailed setup instructions.
Quick Links
- Getting Started - Installation, quick start, and basic setup
- Architecture Overview - High-level runtime components and data flow
- Configuration - Environment variables and setup options
- Routing - Route definition, parameters, and organization
- Controllers - Creating and organizing business logic
- Middleware - Request processing and middleware chains
- Queue System - Background task processing and job queues
- Testing - Unit and Docker-backed integration testing
- Docker Deployment - Production deployment with Docker
- Redis Integration - Caching, sessions, and distributed features
- Rate Limiting - Advanced rate limiting strategies
- Examples - Practical examples and use cases
- API Reference - Complete API documentation
- Monitoring - Health, readiness, and observability hooks
- Release Conformance - SLSA, Scorecard, SBOM, and SemVer evidence
- FAQ - Frequently asked questions
Project Health
- Security Policy - Private vulnerability reporting and supported versions
- Contributing Guide - Issue reports, pull requests, tests, and coding standards
- Code of Conduct - Community expectations and enforcement
- Changelog - Release history
- Issue Tracker - Bug reports and feature requests
Project Structure
Scaffolded projects follow this layout:
my-app/
├── app/ # Your application code
│ ├── controllers/ # Route handlers
│ ├── middleware/ # Custom middleware
│ ├── models/ # Database models
│ ├── jobs/ # Background jobs
│ └── routers/ # Route definitions
├── bootstrap/ # Application bootstrap
├── docker-compose.yml # Optional Docker setup
├── pyproject.toml # Project metadata and dependencies
└── .env # Environment configuration
Docker Deployment
RouteMQ can scaffold Docker support for Redis, MySQL, app runtime, and queue workers:
routemq new my-app --with-docker --with-redis --with-mysql --with-queue
cd my-app
# Start services from the scaffolded project
docker compose up -d
# View logs
docker compose logs -f
# Scale workers
docker compose up -d --scale queue-worker-default=5
See Docker Deployment Guide for detailed instructions.
Background Task Queue
Process time-consuming tasks asynchronously with the built-in queue system:
# Create a job
from routemq.job import Job
class SendEmailJob(Job):
max_tries = 3
queue = "emails"
async def handle(self):
# Send email logic
pass
# Dispatch the job
from routemq.queue.queue_manager import dispatch
job = SendEmailJob()
job.to = "user@example.com"
await dispatch(job)
Run a worker from your scaffolded app:
routemq queue-work --queue emails
See Queue System Documentation for the complete guide.
Advanced: Fork the framework
If you want to modify the framework internals directly (rather than depend on the published wheel), see TEMPLATE.md. This path is deprecated as the primary workflow; pip install routemq[cli] is recommended for application development.
For direct framework development:
git clone https://github.com/ardzz/RouteMQ.git
cd RouteMQ
uv sync --all-extras --dev
uv run python run_tests.py
Contributing
We welcome contributions! Please see our documentation for development setup and contribution guidelines.
License
MIT License - see LICENSE file for details.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file routemq-0.22.1.tar.gz.
File metadata
- Download URL: routemq-0.22.1.tar.gz
- Upload date:
- Size: 723.0 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.13
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
5487cfa2260a2725bff4e235c05ab69c5eb9e1538212dc6ec32c758b3e4cb236
|
|
| MD5 |
a0bc29005d226d1f37c752b6b2eb813e
|
|
| BLAKE2b-256 |
44473d86017c2266e2e39e554700ff2d29f46c80c05f6d992ad4ee9d1121067c
|
Provenance
The following attestation bundles were made for routemq-0.22.1.tar.gz:
Publisher:
publish.yml on ardzz/RouteMQ
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
routemq-0.22.1.tar.gz -
Subject digest:
5487cfa2260a2725bff4e235c05ab69c5eb9e1538212dc6ec32c758b3e4cb236 - Sigstore transparency entry: 1669175414
- Sigstore integration time:
-
Permalink:
ardzz/RouteMQ@c1307dc6842540faa8532e5bf5665335a9154621 -
Branch / Tag:
refs/tags/v0.22.1 - Owner: https://github.com/ardzz
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@c1307dc6842540faa8532e5bf5665335a9154621 -
Trigger Event:
workflow_dispatch
-
Statement type:
File details
Details for the file routemq-0.22.1-py3-none-any.whl.
File metadata
- Download URL: routemq-0.22.1-py3-none-any.whl
- Upload date:
- Size: 90.0 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.13
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
9682a014597d0ad15d9527a75cdb36747c52afe6d37630d72bd896b2a70fa4be
|
|
| MD5 |
285b50aee8153e97ba4cc1c0d3d119ec
|
|
| BLAKE2b-256 |
e6513ab2e074518a46077f52a33dced51bfd838ca137dbb8f52d5dc2c023f5be
|
Provenance
The following attestation bundles were made for routemq-0.22.1-py3-none-any.whl:
Publisher:
publish.yml on ardzz/RouteMQ
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
routemq-0.22.1-py3-none-any.whl -
Subject digest:
9682a014597d0ad15d9527a75cdb36747c52afe6d37630d72bd896b2a70fa4be - Sigstore transparency entry: 1669175530
- Sigstore integration time:
-
Permalink:
ardzz/RouteMQ@c1307dc6842540faa8532e5bf5665335a9154621 -
Branch / Tag:
refs/tags/v0.22.1 - Owner: https://github.com/ardzz
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@c1307dc6842540faa8532e5bf5665335a9154621 -
Trigger Event:
workflow_dispatch
-
Statement type: