{"id":51605338,"url":"https://github.com/emre-onal/messager","last_synced_at":"2026-07-12T01:34:38.586Z","repository":{"id":295866448,"uuid":"991454309","full_name":"emre-onal/messager","owner":"emre-onal","description":"Messager - Fast \u0026 Strong Messaging Tool","archived":false,"fork":false,"pushed_at":"2025-11-20T22:21:11.000Z","size":272,"stargazers_count":0,"open_issues_count":7,"forks_count":0,"subscribers_count":0,"default_branch":"main","last_synced_at":"2026-07-12T01:34:37.328Z","etag":null,"topics":["message","messaging","messaging-tool","notification"],"latest_commit_sha":null,"homepage":"","language":"Go","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"bsd-3-clause","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/emre-onal.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":"CODE_OF_CONDUCT.md","threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":"SECURITY.md","support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null}},"created_at":"2025-05-27T16:42:56.000Z","updated_at":"2025-05-27T21:04:37.000Z","dependencies_parsed_at":"2025-05-27T19:41:49.906Z","dependency_job_id":"3b876e90-95f7-4fbe-ac2d-93e0e58df0fa","html_url":"https://github.com/emre-onal/messager","commit_stats":null,"previous_names":["nemre/messager","emre-onal/messager"],"tags_count":1,"template":false,"template_full_name":null,"purl":"pkg:github/emre-onal/messager","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/emre-onal%2Fmessager","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/emre-onal%2Fmessager/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/emre-onal%2Fmessager/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/emre-onal%2Fmessager/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/emre-onal","download_url":"https://codeload.github.com/emre-onal/messager/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/emre-onal%2Fmessager/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":35379590,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-05-26T15:22:16.424Z","status":"online","status_checked_at":"2026-07-11T02:00:05.354Z","response_time":104,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["message","messaging","messaging-tool","notification"],"created_at":"2026-07-12T01:34:37.866Z","updated_at":"2026-07-12T01:34:38.581Z","avatar_url":"https://github.com/emre-onal.png","language":"Go","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Messager - Fast \u0026 Strong Messaging Tool 🚀\n\n[![Go Reference](https://pkg.go.dev/badge/github.com/nemre/messager.svg)](https://pkg.go.dev/github.com/nemre/messager)\n[![Go Report Card](https://goreportcard.com/badge/github.com/nemre/messager)](https://goreportcard.com/report/github.com/nemre/messager)\n[![License: BSD-3-Clause](https://img.shields.io/badge/license-BSD--3--Clause-blue)](https://opensource.org/license/bsd-3-clause)\n[![GitHub Release](https://img.shields.io/github/release/nemre/messager.svg)](https://github.com/nemre/messager/releases)\n\nMessager is a high-performance, scalable messaging service built with Go. It provides a robust platform for message queuing and delivery, featuring real-time status updates, persistent storage, and reliable message processing capabilities.\n\n![Banner](https://github.com/nemre/messager/blob/main/.github/assets/banner.png)\n\n## 📑 Table of Contents\n\n- [Features](#-features)\n- [System Architecture](#%EF%B8%8F-system-architecture)\n- [Getting Started](#-getting-started)\n- [API Reference](#-api-reference)\n- [Configuration](#-configuration)\n- [Development](#-development)\n- [Logging](#logging)\n- [Security](#-security)\n- [Contributing](#-contributing)\n- [License](#-license)\n\n## Big Picture\n\n![Big Picture](https://github.com/nemre/messager/blob/main/.github/assets/big-picture.png)\n\nThe application exposes a REST API that allows users to create a message by providing content and phone data. Users can then retrieve a list of their messages and control the execution of jobs—starting or stopping them—through the same API.\n\nOnce a job is initiated, it periodically updates the status of messages that are in the pending state. These database changes are captured by Debezium and published to a Kafka topic. A Kafka consumer within the application listens for these changes and triggers an HTTP request to the corresponding client.\n\nThe metadata returned from the client is then stored in Redis. This eventual consistency architecture ensures resilience against common trade-offs such as:\n\n- The database being updated, but the HTTP request not being sent.\n- The HTTP request being sent, but the database not being updated.\n- Duplicate requests being triggered.\n\nThanks to the consumer-based design, the application can scale horizontally by running multiple replicas, enabling faster message processing. The overall architecture is designed with high availability in mind.\n\nThe application follows Domain-Driven Design (DDD) principles and applies SOLID principles effectively, using appropriate abstractions and design patterns to ensure extensibility and maintainability. Additionally, by avoiding third-party libraries—including HTTP frameworks—the system reduces external dependencies and increases robustness. Any component can be replaced or modified without disrupting the integrity of other application layers.\n\n## 🌟 Features\n\n### Core Features\n- **Message Management**\n  - Create and queue messages with validation\n  - Track message status (PENDING → SENT)\n  - Phone number validation with international format\n  - Message content validation (10-255 characters)\n  \n### Technical Features\n- **High Performance**\n  - Asynchronous message processing\n  - Redis caching for sent message info\n  - Kafka-based message queue\n  - PostgreSQL for persistent storage\n  \n### Integration Features\n- **Real-time CDC with Debezium**\n  - Capture database changes in real-time\n  - Automatic status updates via Kafka\n  - Event-driven architecture\n  \n### Operational Features\n- **Monitoring \u0026 Management**\n  - Health check endpoints\n  - Structured JSON logging\n  - Correlation ID tracking\n\n\n## 🏗️ System Architecture\n\n### Clean Architecture Implementation\n```\n┌─────────────────────────────────────────────────────┐\n│                   Presentation Layer                │\n│   ┌─────────────┐    ┌──────────┐    ┌─────────┐    │\n│   │  REST API   │    │   Jobs   │    │ Kafka   │    │\n│   │  Handlers   │    │ Processor│    │Consumer │    │\n│   └─────────────┘    └──────────┘    └─────────┘    │\n├─────────────────────────────────────────────────────┤\n│                  Application Layer                  │\n│   ┌─────────────┐    ┌──────────┐    ┌─────────┐    │\n│   │  Message    │    │ Business │    │ Service │    │\n│   │  Services   │    │  Logic   │    │ Layer   │    │\n│   └─────────────┘    └──────────┘    └─────────┘    │\n├─────────────────────────────────────────────────────┤\n│                    Domain Layer                     │\n│   ┌─────────────┐    ┌──────────┐    ┌─────────┐    │\n│   │  Entities   │    │Repository│    │ Domain  │    │\n│   │  \u0026 Models   │    │Interface │    │Services │    │\n│   └─────────────┘    └──────────┘    └─────────┘    │\n├─────────────────────────────────────────────────────┤\n│                Infrastructure Layer                 │\n│┌────────┐ ┌─────┐ ┌────────┐ ┌────-─┐ ┌──────────┐  │\n││Postgres│ │Redis│ │ Kafka  │ │HTTP  │ │ Logger   │  │\n││  DB    │ │Cache│ │ Queue  │ │Client│ │\u0026 Monitor │  │\n│└────────┘ └─────┘ └────────┘ └─────-┘ └──────────┘  │\n└─────────────────────────────────────────────────────┘\n```\n\n## 🚀 Getting Started\n\n### Prerequisites\n```bash\n# Check Go version (requires 1.24+)\ngo version\n\n# Check Docker version\ndocker --version\ndocker-compose --version\n```\n\n### Detailed Installation Steps\n\n1. **Clone and Setup**\n   ```bash\n   # Clone repository\n   git clone https://github.com/nemre/messager.git\n   cd messager\n   \n   # Create environment file\n   cp .env.example .env\n   \n   # Initialize Go modules\n   go mod tidy\n   ```\n\n2. **Configure Environment**\n   ```bash\n   # Edit .env file with your settings\n   nano .env\n   \n   # Required settings:\n   # - Server configuration (SERVER_*)\n   # - Database credentials (POSTGRESQL_*)\n   # - Redis settings (REDIS_*)\n   # - Kafka configuration (KAFKA_*)\n   # - Client settings (CLIENT_*)\n   ```\n\n3. **Start Services**\n   ```bash\n   # Start all services\n   docker-compose up -d\n   \n   # Verify services are running\n   docker-compose ps\n   \n   # Check logs\n   docker-compose logs -f\n   ```\n\n4. **Verify Installation**\n   ```bash\n   # Check API health\n   curl http://localhost:2025/health\n   \n   # Should return:\n   # {\"status\":\"green\"}\n   ```\n\n## 📚 API Reference\n\n### Swagger\nhttp://localhost:2025/swagger/index.html\n\n### Create Message\n```bash\ncurl -X POST http://localhost:2025/messages \\\n  -H \"Content-Type: application/json\" \\\n  -d '{\n    \"content\": \"Your message content\",\n    \"phone\": \"+905321234567\"\n  }'\n```\n\n### List Messages\n```bash\n# Get PENDING messages\ncurl http://localhost:2025/messages?status=PENDING\n\n# Get SENT messages\ncurl http://localhost:2025/messages?status=SENT\n```\n\n### Manage Message Processing\n```bash\n# Start processing\ncurl -X POST http://localhost:2025/messages/jobs\n\n# Stop processing\ncurl -X DELETE http://localhost:2025/messages/jobs\n```\n\n## 🔧 Configuration\n\n### Environment Variables\n```dotenv\n# Server Configuration\nSERVER_HOST=0.0.0.0\nSERVER_PORT=2025\nSERVER_ID_HEADER=X-Correlation-ID\n\n# PostgreSQL Configuration\nPOSTGRESQL_HOST=postgres\nPOSTGRESQL_PORT=5432\nPOSTGRESQL_USER=messager\nPOSTGRESQL_PASSWORD=messager\nPOSTGRESQL_NAME=messager\n\n# Redis Configuration\nREDIS_HOST=redis\nREDIS_PORT=6379\nREDIS_DB=0\n\n# Job Configuration\nJOB_INTERVAL=2m\n\n# Kafka Configuration\nKAFKA_BROKERS=kafka:9092\nKAFKA_TOPIC=messager.public.messages\nKAFKA_GROUP_ID=messager\n\n# Client Configuration\nCLIENT_URL=https://api.example.com\nCLIENT_TOKEN=your-token\nCLIENT_TIMEOUT=5s\n```\n\n## 💻 Development\n\n### Project Structure\n```\nmessager/\n├── application/                 # Application Services\n│   └── service/\n│       └── message/            # Message Service Implementation\n├── domain/                     # Domain Layer\n│   └── message/               \n│       ├── entity.go          # Message Entity \u0026 Validation\n│       ├── repository.go      # Repository Interface\n│       └── service.go         # Service Interface\n├── infrastructure/            # Infrastructure Layer\n│   ├── client/               # HTTP Client\n│   ├── config/               # Configuration\n│   ├── database/             # Database Implementations\n│   ├── logger/               # Structured Logger\n│   ├── persistence/          # Repository Implementations\n│   └── server/               # HTTP Server\n└── presentation/             # Presentation Layer\n    ├── consumer/             # Kafka Consumers\n    ├── handler/              # HTTP Handlers\n    └── job/                  # Background Jobs\n```\n\n## Logging\n- Structured JSON logs\n- Log levels: DEBUG, INFO, WARNING, ERROR, FATAL\n- Correlation ID tracking\n- Separate stdout/stderr streams\n\n## 🔐 Security\n\n### Security Features\n- TLS support\n- Token-based authentication\n- Input validation\n- Rate limiting\n- Secure defaults\n\n### Security Policy\nSee [SECURITY.md](SECURITY.md) for:\n- Supported versions\n- Reporting vulnerabilities\n- Security update policy\n\n## 👥 Contributing\n\nWe welcome contributions! Please see:\n- [CODE_OF_CONDUCT.md](CODE_OF_CONDUCT.md)\n- [SECURITY.md](SECURITY.md)\n\n### Development Process\n1. Fork the repository\n2. Create your feature branch\n3. Commit your changes\n4. Push to the branch\n5. Create a Pull Request\n\n## 📝 License\n\nThis project is licensed under the BSD 3-Clause License - see the [LICENSE](LICENSE) file for details.\n\n## 🙏 Acknowledgments\n\n### Technologies\n- [Go](https://golang.org/)\n- [PostgreSQL](https://www.postgresql.org/)\n- [Redis](https://redis.io/)\n- [Apache Kafka](https://kafka.apache.org/)\n- [Debezium](https://debezium.io/)\n- [Docker](https://www.docker.com/)\n\n### Libraries\n- [pgx](https://github.com/jackc/pgx)\n- [go-redis](https://github.com/redis/go-redis)\n- [kafka-go](https://github.com/segmentio/kafka-go)\n- [phonenumbers](https://github.com/nyaruka/phonenumbers)\n- [uuid](https://github.com/google/uuid)\n- [env](https://github.com/caarlos0/env)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Femre-onal%2Fmessager","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Femre-onal%2Fmessager","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Femre-onal%2Fmessager/lists"}