Task Management Service implemented in Go using gRPC and PostgreSQL.
This repository contains a simple task management service with the following features:
- Create, retrieve, update, and delete tasks
- Change task status
- Store data in PostgreSQL
- Manage database migrations via golang-migrate
- Containerized deployment using Docker and Docker Compose
- Language: Go 1.24
- API: gRPC with Protocol Buffers
- Database: PostgreSQL
- Migrations: golang-migrate
- Validation: go-playground/validator
- Logging: Go’s slog package
- Containerization: Docker, Docker Compose
- Clone the repository
git clone https://github.com/Citadelas/task.git cd task
- Create configuration file
Place a file namedlocal.yaml
in theconfig
directory or set theCONFIG_PATH
environment variable. Examplelocal.yaml
:
env: "local" storage_path: "postgres://postgres:postgres@postgres-db:5432/task?sslmode=disable" grpc: port: 44044 timeout: 5s
- Run with Docker Compose
docker-compose up --build
- postgres-db: PostgreSQL database
- db-migrate: Applies database migrations
- task-app: Task management service
- Access the service
Use a gRPC client to connect tolocalhost:44044
.
Configuration parameters are loaded from a YAML file or the CONFIG_PATH
environment variable:
env
– Environment identifier:local
,dev
, orprod
storage_path
– PostgreSQL connection stringgrpc.port
– Service portgrpc.timeout
– gRPC request timeout
.
├── cmd
│ └── task # Entry point (main.go)
├── internal
│ ├── config # Configuration loader
│ ├── domain
│ │ └── models # Domain models
│ ├── grpc # gRPC server implementation and validation
│ ├── services # Business logic for tasks
│ ├── storage # PostgreSQL storage implementation
│ └── lib/logger # Logging utilities
├── migrations # Database migration scripts
├── Dockerfile # Docker build instructions
├── docker-compose.yml # Docker Compose configuration
├── go.mod # Go module file
└── README.md # This file
- CreateTask
Create a new task with title, description, and priority. - GetTask
Retrieve a task by its ID. - UpdateTask
Update one or more fields of an existing task. - DeleteTask
Remove a task by its ID. - UpdateStatus
Change the status of an existing task.
- Priority:
LOW
,MEDIUM
,HIGH
- Status:
BACKLOG
,NEW
,IN_PROGRESS
,DONE
- All input fields are validated (length constraints, required fields, enum values)
- Custom errors:
ErrTaskNotFound
,ErrInputTooLong
- Errors are mapped to appropriate gRPC status codes
- Add authentication and authorization
- Implement unit and integration tests
- Introduce pagination and filtering for task listings
- Provide health checks and metrics
- Expand documentation (e.g., OpenAPI definitions, usage examples)