How beliyzy/task-tracker-golang works
Project Type and Purpose
The Task Tracker is a microservice-based task management system written in Go. It provides RESTful APIs for user/project/task operations, asynchronous task processing, real-time notifications via Telegram, and uses Redis, PostgreSQL, RabbitMQ, and a dedicated gRPC notification service.
Main Components
a. API Service (cmd/api)
• Exposes HTTP endpoints for authentication, tasks, and projects.
• Layers:
• Handlers (internal/handlers)
• Services (internal/service)
• Repositories (internal/repository)
• Domain models (internal/domain)
• Integrations: PostgreSQL, Redis, RabbitMQ (publishing), JWT auth (pkg/auth).
b. Worker Service (cmd/worker)
• Consumes messages from RabbitMQ (pkg/queue)
• Executes asynchronous task logic (internal/service)
• Calls Notification Service via gRPC client (internal/client/notification.go)
c. Notification Service (cmd/notification)
• gRPC server (internal/proto) implementing NotificationService
• Sends real-time alerts to Telegram (internal/client/telegram.go)
d. Infrastructure
• PostgreSQL (docker-compose “postgres” service) for persistence
• Redis (docker-compose “redis”) for caching/session management (pkg/cache)
• RabbitMQ (docker-compose “rabbitmq”) for message queuing
• External Telegram Bot API
Relationships and Data Flows
• Clients (UI or curl/Postman) → HTTP (API Service)
• API Service → read/write → PostgreSQL
• API Service ↔ cache → Redis
• API Service → publish → RabbitMQ “task” queue
• Worker Service ← consume ← RabbitMQ
• Worker Service → gRPC call → Notification Service
• Notification Service → HTTP → Telegram API
Architectural Patterns and Principles
• Microservices: each service has a single responsibility and can scale independently.
• Layered architecture within services: separation of handlers, business logic, data access.
• Asynchronous messaging: decouple API requests from long-running tasks via RabbitMQ.
• gRPC contract: well-typed notification protocol (internal/proto/*.proto).
• Configuration via environment variables or YAML (internal/config).
• Reusable utility packages in pkg/ (auth, cache, queue).