A distributed messaging platform built on the Kratos framework, providing unified message delivery and management capabilities.
Rabbit (Jade Rabbit) is a high-performance, highly available, and highly scalable distributed messaging service platform. It supports unified management and delivery of multiple message channels (email, Webhook, SMS, Feishu, etc.), implements multi-tenant isolation through namespaces, and supports both file-based and database storage modes to meet different deployment requirements.
- Multi-channel Messaging: Unified management of email, Webhook, SMS, Feishu, and other message channels
- Template-based Delivery: Support for message template configuration with dynamic content rendering and reuse
- Asynchronous Processing: Queue-based asynchronous message delivery for improved throughput and reliability
- Configuration Management: Centralized management of channel configurations (email servers, Webhook endpoints, etc.)
- Multi-tenant Isolation: Namespace-based isolation of configurations and data for different businesses or tenants
- Flexible Storage: Support for both file-based and database storage modes
- Rich CLI Tools: Comprehensive command-line interface for service management, message sending, and configuration generation
- Hot Reload: Support for hot reloading of configurations without service restart
- Go 1.25+ (for building from source)
- Docker & Docker Compose (for containerized deployment)
- MySQL 8.0+ (optional, for database storage mode)
- etcd (optional, for service registry)
# Clone the repository
git clone https://github.com/aide-family/rabbit.git
cd rabbit
# Initialize the environment
make init
# Build the binary
make build
# Run the service
./bin/rabbit run all# Build the Docker image
docker build -t rabbit:latest .
# Run the container
docker run -d \
--name rabbit \
-p 8080:8080 \
-p 9090:9090 \
-v $(pwd)/config:/moon/config \
-v $(pwd)/datasource:/moon/datasource \
rabbit:latestcd deploy/server/docker
docker-compose up -ddocker-compose -f deploy/server/docker/docker-compose.yml up
Attaching to rabbit
rabbit | Moon service starting...
rabbit |
rabbit | βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
rabbit | β β
rabbit | β ββββ ββββ βββββββ βββββββ ββββ βββ β
rabbit | β βββββ ββββββββββββββββββββββββββββ βββ β
rabbit | β ββββββββββββββ ββββββ βββββββββ βββ β
rabbit | β ββββββββββββββ ββββββ βββββββββββββ β
rabbit | β βββ βββ ββββββββββββββββββββββββ ββββββ β
rabbit | β βββ βββ βββββββ βββββββ βββ βββββ β
rabbit | β good luck and no bug β
rabbit | βββ Name: Moon β
rabbit | βββ Version: latest β
rabbit | βββ ID: b789d98d95c8 β
rabbit | βββ Env: PREVIEW β
rabbit | βββ NodeID: 722 β
rabbit | βββ Metadata: β
rabbit | β βββ author: Aide Family β
rabbit | β βββ email: 1058165620@qq.com β
rabbit | βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
rabbit | INFO ts=2025-12-17T08:52:55Z service.name=moon.rabbit.job service.id=b789d98d95c8 caller=server/job.go:74 trace.id= span.id= server=job msg=[Job] started address=grpc://172.20.0.2:10070
rabbit | INFO ts=2025-12-17T08:52:55Z service.name=moon.rabbit.job service.id=b789d98d95c8 caller=grpc/server.go:231 trace.id= span.id= msg=[gRPC] server listening on: [::]:10070
rabbit | INFO ts=2025-12-17T08:52:55Z service.name=moon.rabbit.grpc service.id=b789d98d95c8 caller=grpc/server.go:231 trace.id= span.id= msg=[gRPC] server listening on: [::]:10090
rabbit | INFO ts=2025-12-17T08:52:55Z service.name=moon.rabbit.http service.id=b789d98d95c8 caller=http/server.go:330 trace.id= span.id= msg=[HTTP] server listening on: [::]:10080# Generate default configuration file
rabbit config --path ./config --name server.yaml
# Or with custom path
rabbit config -p ./config -N server.yaml
# Force overwrite existing file
rabbit config -p ./config -N server.yaml --force
# Generate client configuration file
rabbit config -p ./config -N client.yaml --clientdocker build -t rabbit-local:latest .See Docker Deployment Documentation for detailed instructions.
docker run -d \
--name rabbit \
-p 8080:8080 \
-p 9090:9090 \
-v $(pwd)/config:/moon/config \
-v $(pwd)/datasource:/moon/datasource \
--restart=always \
rabbit-local:latest run allSee Docker Compose Documentation for detailed instructions.
docker build -t rabbit-local:latest .
docker-compose -f deploy/server/docker/docker-compose.yml up -dSee Kubernetes Deployment Documentation for detailed instructions.
# Create namespace (if not exists)
kubectl create namespace moon --dry-run=client -o yaml | kubectl apply -f -
# Deploy Rabbit service
cd deploy/server/k8s
kubectl apply -f rabbit.yaml-
Build the binary:
make build
-
Generate configuration:
rabbit config -p ./config
-
Edit configuration: Edit
config/server.yamlaccording to your environment. -
Run the service:
./bin/rabbit run all -c ./config/server.yaml
The default configuration file is config/server.yaml. You can specify custom paths using the --config or -c flag (can be used multiple times).
Note: The --use-database and --datasource-paths options are mutually exclusive:
- Use
--use-database truefor database storage mode (recommended for production) - Use
--datasource-pathsfor file-based storage mode (useful for development and testing)
Rabbit supports configuration through environment variables. All environment variables follow the pattern MOON_RABBIT_*.
| Variable | Default | Description |
|---|---|---|
MOON_RABBIT_ENVIRONMENT |
PROD |
Environment: DEV, TEST, PREVIEW, PROD |
MOON_RABBIT_SERVER_NAME |
moon.rabbit |
Service name |
MOON_RABBIT_USE_RANDOM_NODE_ID |
false |
Use random service ID |
MOON_RABBIT_METADATA_TAG |
rabbit |
Service metadata tag |
MOON_RABBIT_METADATA_REPOSITORY |
https://github.com/aide-family/rabbit |
Service metadata repository |
MOON_RABBIT_METADATA_AUTHOR |
Aide Family |
Service metadata author |
MOON_RABBIT_METADATA_EMAIL |
aidecloud@163.com |
Service metadata email |
MOON_RABBIT_HTTP_ADDRESS |
0.0.0.0:8080 |
HTTP server address |
MOON_RABBIT_HTTP_NETWORK |
tcp |
HTTP server network |
MOON_RABBIT_HTTP_TIMEOUT |
10s |
HTTP request timeout |
MOON_RABBIT_GRPC_ADDRESS |
0.0.0.0:9090 |
gRPC server address |
MOON_RABBIT_GRPC_NETWORK |
tcp |
gRPC server network |
MOON_RABBIT_GRPC_TIMEOUT |
10s |
gRPC request timeout |
MOON_RABBIT_JOB_ADDRESS |
0.0.0.0:9091 |
Job server address |
MOON_RABBIT_JOB_NETWORK |
tcp |
Job server network |
MOON_RABBIT_JOB_TIMEOUT |
10s |
Job request timeout |
MOON_RABBIT_JOB_PROTOCOL |
GRPC |
Job protocol: GRPC, HTTP |
| Variable | Default | Description |
|---|---|---|
MOON_RABBIT_USE_DATABASE |
false |
Enable database storage mode (mutually exclusive with MOON_RABBIT_DATASOURCE_PATHS) |
MOON_RABBIT_MAIN_HOST |
localhost |
MySQL host |
MOON_RABBIT_MAIN_PORT |
3306 |
MySQL port |
MOON_RABBIT_MAIN_DATABASE |
rabbit |
Database name |
MOON_RABBIT_MAIN_USERNAME |
root |
MySQL username |
MOON_RABBIT_MAIN_PASSWORD |
123456 |
MySQL password |
MOON_RABBIT_MAIN_DEBUG |
false |
Enable database debug mode |
MOON_RABBIT_MAIN_USE_SYSTEM_LOGGER |
true |
Use system logger for database |
| Variable | Default | Description |
|---|---|---|
MOON_RABBIT_JWT_SECRET |
xxx |
JWT secret key |
MOON_RABBIT_JWT_EXPIRE |
600s |
JWT expiration time |
MOON_RABBIT_JWT_ISSUER |
rabbit |
JWT issuer |
| Variable | Default | Description |
|---|---|---|
MOON_RABBIT_REGISTRY_TYPE |
`` | Registry type: etcd, kubernetes |
MOON_RABBIT_ETCD_ENDPOINTS |
127.0.0.1:2379 |
etcd endpoints (comma-separated) |
MOON_RABBIT_ETCD_USERNAME |
`` | etcd username |
MOON_RABBIT_ETCD_PASSWORD |
`` | etcd password |
MOON_RABBIT_KUBERNETES_NAMESPACE |
moon |
Kubernetes namespace |
MOON_RABBIT_KUBERNETES_KUBECONFIG |
~/.kube/config |
Kubernetes kubeconfig path |
| Variable | Default | Description |
|---|---|---|
MOON_RABBIT_CLUSTER_NAME |
moon.rabbit |
Cluster name |
MOON_RABBIT_CLUSTER_ENDPOINTS |
`` | Cluster endpoints |
MOON_RABBIT_CLUSTER_TIMEOUT |
10s |
Cluster request timeout |
MOON_RABBIT_CLUSTER_PROTOCOL |
GRPC |
Cluster protocol: GRPC, HTTP, JOB |
| Variable | Default | Description |
|---|---|---|
MOON_RABBIT_JOB_CORE_WORKER_TOTAL |
10 |
Total number of job workers |
MOON_RABBIT_JOB_CORE_TIMEOUT |
10s |
Job core timeout |
MOON_RABBIT_JOB_CORE_BUFFER_SIZE |
1000 |
Job core buffer size |
| Variable | Default | Description |
|---|---|---|
MOON_RABBIT_ENABLE_SWAGGER |
false |
Enable Swagger UI |
MOON_RABBIT_ENABLE_METRICS |
false |
Enable metrics endpoint |
MOON_RABBIT_DATASOURCE_PATHS |
`` | Data source file paths (comma-separated, mutually exclusive with MOON_RABBIT_USE_DATABASE) |
MOON_RABBIT_MESSAGE_LOG_PATH |
`` | Message log file path |
| Variable | Default | Description |
|---|---|---|
MOON_RABBIT_SWAGGER_BASIC_AUTH_ENABLED |
true |
Enable Swagger basic authentication |
MOON_RABBIT_SWAGGER_BASIC_AUTH_USERNAME |
moon.rabbit |
Swagger basic auth username |
MOON_RABBIT_SWAGGER_BASIC_AUTH_PASSWORD |
rabbit.swagger |
Swagger basic auth password |
| Variable | Default | Description |
|---|---|---|
MOON_RABBIT_METRICS_BASIC_AUTH_ENABLED |
true |
Enable metrics basic authentication |
MOON_RABBIT_METRICS_BASIC_AUTH_USERNAME |
moon.rabbit |
Metrics basic auth username |
MOON_RABBIT_METRICS_BASIC_AUTH_PASSWORD |
rabbit.metrics |
Metrics basic auth password |
| Flag | Short | Default | Description |
|---|---|---|---|
--namespace |
-n |
`` | The namespace of the service |
--rabbit-config |
./.rabbit/ |
The config file directory of the rabbit | |
--log-format |
TEXT |
Log format: TEXT, JSON | |
--log-level |
DEBUG |
Log level: DEBUG, INFO, WARN, ERROR |
| Flag | Short | Default | Description |
|---|---|---|---|
--path, -p |
. |
Output path for the config file | |
--name, -N |
config.yaml |
Output file name | |
--force, -f |
false |
Overwrite existing file if it exists (default is to rename with timestamp) | |
--client |
false |
Generate client config file instead of server config |
| Flag | Default | Description |
|---|---|---|
--config, -c |
`` | Configuration file path (can be used multiple times) |
--enable-client-config |
false |
Enable client configuration |
--server-name |
rabbit |
Server name |
--use-random-node-id |
false |
Use random node ID |
--server-metadata |
`` | Server metadata (format: key=value, can be used multiple times) |
--environment |
PROD |
Environment: DEV, TEST, PREVIEW, PROD |
--jwt-secret |
xxx |
JWT secret key |
--jwt-expire |
600s |
JWT expiration time |
--jwt-issuer |
rabbit |
JWT issuer |
--main-username |
root |
MySQL username |
--main-password |
123456 |
MySQL password |
--main-host |
localhost |
MySQL host |
--main-port |
3306 |
MySQL port |
--main-database |
rabbit |
Database name |
--main-debug |
false |
Enable database debug mode |
--main-use-system-logger |
true |
Use system logger for database |
--registry-type |
`` | Registry type: ETCD, KUBERNETES |
--etcd-endpoints |
127.0.0.1:2379 |
etcd endpoints |
--etcd-username |
`` | etcd username |
--etcd-password |
`` | etcd password |
--kubernetes-kubeconfig |
~/.kube/config |
Kubernetes kubeconfig path |
--use-database |
false |
Enable database storage mode (mutually exclusive with --datasource-paths) |
--datasource-paths |
`` | Data source file paths (comma-separated, mutually exclusive with --use-database) |
--message-log-path |
`` | Message log file path |
| Flag | Default | Description |
|---|---|---|
--http-address |
0.0.0.0:8080 |
HTTP server address |
--http-network |
tcp |
HTTP server network |
--http-timeout |
10s |
HTTP request timeout |
--grpc-address |
0.0.0.0:9090 |
gRPC server address |
--grpc-network |
tcp |
gRPC server network |
--grpc-timeout |
10s |
gRPC request timeout |
--job-address |
0.0.0.0:9091 |
Job server address |
--job-network |
tcp |
Job server network |
--job-timeout |
10s |
Job request timeout |
--job-core-worker-total |
10 |
Total number of job workers |
--job-core-timeout |
10s |
Job core timeout |
--job-core-buffer-size |
1000 |
Job core buffer size |
--enable-swagger |
false |
Enable Swagger UI |
--enable-swagger-basic-auth |
true |
Enable Swagger basic authentication |
--swagger-basic-auth-username |
moon.rabbit |
Swagger basic auth username |
--swagger-basic-auth-password |
rabbit.swagger |
Swagger basic auth password |
--enable-metrics |
false |
Enable metrics endpoint |
--enable-metrics-basic-auth |
true |
Enable metrics basic authentication |
--metrics-basic-auth-username |
moon.rabbit |
Metrics basic auth username |
--metrics-basic-auth-password |
rabbit.metrics |
Metrics basic auth password |
--enable-client-config |
false |
Enable client configuration |
| Flag | Short | Default | Description |
|---|---|---|---|
--config, -c |
./config |
Config file path | |
--force-gen, -f |
false |
Force generate code, overwrite existing | |
--username |
root |
MySQL username | |
--password |
123456 |
MySQL password | |
--host |
localhost |
MySQL host | |
--port |
3306 |
MySQL port | |
--database |
rabbit |
MySQL database | |
--params |
charset=utf8mb4,parseTime=true,loc=Asia/Shanghai |
MySQL connection parameters | |
--biz, -b |
false |
Use biz namespace configuration |
See rabbit run --help and rabbit run all --help for all available flags.
# Run all services (HTTP, gRPC, Job) with custom configuration file
rabbit run all -c ./config/server.yaml
# Run only HTTP server
rabbit run http -c ./config/server.yaml
# Run only gRPC server
rabbit run grpc -c ./config/server.yaml
# Run only Job server
rabbit run job -c ./config/server.yaml
# Run with multiple configuration files
rabbit run all -c ./config/server.yaml -c ./config/override.yaml
# Run with environment variables
MOON_RABBIT_HTTP_ADDRESS=0.0.0.0:8080 \
MOON_RABBIT_USE_DATABASE=true \
rabbit run all
# Run with database storage mode
rabbit run all \
--http-address 0.0.0.0:8080 \
--grpc-address 0.0.0.0:9090 \
--job-address 0.0.0.0:9091 \
--use-database true
# Run with file-based storage mode
rabbit run all \
--http-address 0.0.0.0:8080 \
--grpc-address 0.0.0.0:9090 \
--job-address 0.0.0.0:9091 \
--datasource-paths ./datasource,./configrabbit config- Generate default configuration filerabbit version- Display version information
rabbit send email- Send email messagesrabbit send sms- Send SMS messagesrabbit send feishu- Send Feishu messagesrabbit apply- Apply messages to queuerabbit get- Get message informationrabbit delete- Delete messages
rabbit run- Start the Rabbit servicerabbit run all- Start all services (HTTP, gRPC, Job)rabbit run http- Start only HTTP serverrabbit run grpc- Start only gRPC serverrabbit run job- Start only Job server
rabbit gorm- GORM code generation and database migration toolsrabbit gorm gen- Generate GORM query coderabbit gorm migrate- Migrate database schema
See rabbit --help for detailed command information.
- Go 1.25+
- Make
- Protocol Buffers compiler (protoc)
- MySQL 8.0+ (for database mode)
# Clone the repository
git clone https://github.com/aide-family/rabbit.git
cd rabbit
# Initialize the environment
make init
# Generate all code
make all
# Run tests
make test
# Run in development mode
make devrabbit/
βββ cmd/ # Command-line interface
βββ internal/ # Internal packages
β βββ biz/ # Business logic
β βββ data/ # Data layer
β βββ server/ # Server implementation
β βββ conf/ # Configuration
βββ pkg/ # Public packages
βββ proto/ # Protocol buffer definitions
βββ config/ # Configuration files
βββ deploy/ # Deployment configurations
βββ Makefile # Build scripts
We welcome contributions! Please read our contributing guidelines before submitting PRs.
- Fork the repository and create your branch from
main - Create an issue to discuss your changes (if it's a significant change)
- Make your changes following our code style guidelines
- Add tests for new features or bug fixes
- Update documentation as needed
- Ensure all tests pass (
make test) - Submit a Pull Request with a clear description
<type>(<scope>): <subject>
<body>
<footer>
Types:
feat: New featurefix: Bug fixdocs: Documentation changesstyle: Code style changes (formatting, etc.)refactor: Code refactoringtest: Test additions or changeschore: Build process or auxiliary tool changes
Example:
feat(message): add email template support
Add support for email templates with dynamic variable substitution.
Templates can be defined in the configuration file and referenced
by name when sending emails.
Closes #123
- Code follows the project's style guidelines
- Self-review completed
- Comments added for complex code
- Documentation updated
- Tests added/updated
- All tests pass
- No new warnings introduced
- Changes are backward compatible (or migration guide provided)
When reporting issues, please include:
- Issue Type: Bug, Feature Request, Question, etc.
- Description: Clear description of the issue
- Steps to Reproduce: For bugs, provide steps to reproduce
- Expected Behavior: What you expected to happen
- Actual Behavior: What actually happened
- Environment: OS, Go version, Rabbit version
- Configuration: Relevant configuration (sanitized)
- Logs: Relevant log output
- Screenshots: If applicable
This project is licensed under the MIT License - see the LICENSE file for details.
-
Repository: https://github.com/aide-family/rabbit
-
Email: aidecloud@163.com
-
Feishu:


Made with β€οΈ by Aide Family