MarioCarrion/todo-api-microservice-example
62.7
Adequate · 8 November 2026
2.5k
lines of production code
Go
primary language
7
measurements over time
What this system is
This system is a task management microservice that exposes a type-safe REST API for creating, updating, and searching tasks. It persists task data in PostgreSQL and enhances search capabilities through Elasticsearch, while utilizing Memcached for performance optimization. The architecture supports asynchronous event-driven communication by publishing task lifecycle changes to Kafka, RabbitMQ, or Redis, and manages secrets securely via HashiCorp Vault.
Features
Add Elasticsearch indexing service with multi-broker support
Introduces new standalone services for indexing tasks into Elasticsearch, available via Kafka, RabbitMQ, or Redis as the message broker. The \cmd\ directory now includes \elasticsearch-indexer-kafka\, \elasticsearch-indexer-rabbitmq\, and \elasticsearch-indexer-redis\ binaries, each consuming task events (created, updated, deleted) and persisting them to Elasticsearch. Additionally, the REST server (\cmd/rest-server\) is updated to support these message brokers via build tags (\kafka\, \rabbitmq\, or default Redis), allowing the API to publish events to the indexer. Internal helpers in \cmd/internal\ provide client initialization for Elasticsearch, Kafka, RabbitMQ, Redis, PostgreSQL, Memcached, and Vault.
cmd · high confidence
Add Elasticsearch repository for task persistence
Introduces a new internal Elasticsearch repository (\internal/elasticsearch\) that enables storing, searching, and deleting task records. The implementation uses the \go-elasticsearch/v7\ client to index tasks with fields like description, priority, and completion status, and supports filtering by these attributes with pagination. Tests verify the repository's functionality using a Dockerized Elasticsearch 7.17.28 instance, ensuring cluster health before executing operations.
internal/elasticsearch · high confidence
Add Kafka event publisher for task lifecycle events
The internal/kafka package now includes a new Task publisher that emits structured JSON events to Kafka for task creation, deletion, and updates. This publisher uses the confluent-kafka-go v2 client to send messages with specific event types (Task.Created, Task.Deleted, Task.Updated) to a configurable topic, enabling downstream services to react to task state changes.
internal/kafka · high confidence
Add RabbitMQ event publishing for Task lifecycle changes
The internal/rabbitmq package now includes a Task repository that publishes domain events to a RabbitMQ exchange named 'Tasks' using the AMQP 0.9.1 protocol. It supports publishing Task.Created, Task.Updated, and Task.Deleted events via specific routing keys (e.g., 'Task.Created'), serializing payloads using Go's gob encoding. This enables other services to subscribe to task lifecycle changes via the 'Task.\*' wildcard routing key.
internal/rabbitmq · high confidence
Adopts 'Tools as Dependencies' pattern for internal development tooling
The repository now manages development tools as Go module dependencies within the internal/tools package. This change introduces a standardized set of tools—including golangci-lint, sqlc, oapi-codegen, govulncheck, and others—allowing them to be installed and version-controlled alongside the project code via \make tools\. This ensures consistent tool versions across environments and simplifies the setup process for developers.
internal/tools · high confidence
Introduce memcached repository with Write-Through and Cache-Aside strategies
The \internal/memcached\ package now provides a task repository implementation that caches task data using Memcached. The \Task\ type implements a Write-Through caching strategy for Create and Update operations, ensuring the cache is updated synchronously with the underlying store, and a Cache-Aside strategy for Find operations, populating the cache on misses. Additionally, the \SearchableTask\ type applies Cache-Aside caching to search queries, storing results for 25 seconds to reduce load on the original store. The implementation includes generated test doubles (\FakeTaskStore\, \FakeSearchableTaskStore\) and comprehensive tests verifying cache hit/miss behavior and store interaction.
internal/memcached · high confidence
Introduces OpenAPI 3 code generation and Docker Compose infrastructure for local development
The project now generates a type-safe HTTP client (\client.gen.go\) from an OpenAPI 3 specification using \oapi-codegen\, replacing manual client construction with standardized models and request handlers. Additionally, a comprehensive Docker Compose setup is introduced, allowing developers to run the REST server and its dependencies (PostgreSQL, Elasticsearch, Memcached, Vault) locally, with support for pluggable message brokers (Redis, RabbitMQ, Kafka) via separate compose files.
(repo-wide) · high confidence
Introduces structured error handling and domain models for task management
The internal package now provides a structured error system with typed codes (Unknown, NotFound, InvalidArgument) and wrapping support, alongside core domain types for Tasks including Priority, Dates, and validation logic. It also introduces parameter structs (CreateParams, SearchParams, UpdateParams) for API inputs and utility functions like PointerToValue, establishing the foundational data structures and error semantics for the application.
internal · high confidence
New Dockerfiles for Elasticsearch indexers and REST server
Added Dockerfiles for the elasticsearch-indexer (with Kafka, RabbitMQ, and Redis variants) and the REST server. These files define multi-stage builds using golang:1.27.1-bookworm and debian:bookworm-20260824-slim, producing static binaries. The REST server Dockerfile includes the OpenAPI spec and exposes port 9234.
dockerfiles · high confidence
PostgreSQL repository implementation using pgx/v5 and sqlc
The internal/postgresql package now provides a concrete repository for Task persistence, replacing previous database interaction patterns. It utilizes the pgx/v5 driver and sqlc-generated code to handle database operations, including creating, finding, updating, and deleting tasks. The implementation includes type-safe conversion logic for internal domain models (such as Priority and Timestamps) to database types and introduces unit tests for these conversions alongside integration tests that spin up a real PostgreSQL container to verify repository behavior.
internal/postgresql · high confidence
REST API layer now uses OpenAPI-generated types and strict server handlers
The internal REST package has been refactored to use code generation from the OpenAPI specification (via oapi-codegen) instead of manual routing and struct definitions. This introduces generated strict-server interfaces and type-safe request/response models (e.g., CreateTaskRequestObject, Task) in server.gen.go, along with new custom types in dates.go and priority.go that handle validation and JSON marshaling/unmarshaling. The task\_handler.go now implements these generated interfaces, converting between the generated REST types and the internal domain models, providing a more robust and type-safe HTTP API layer.
internal/rest · high confidence
Redis-based event publishing for task lifecycle changes
The internal/redis package now includes a Task repository that publishes JSON-encoded events to Redis Pub/Sub channels whenever a task is created, updated, or deleted. This enables other services to subscribe to specific task events (e.g., Task.Created, Task.Updated, Task.Deleted) or all task events via a wildcard pattern, facilitating asynchronous communication within the microservice architecture.
internal/redis · high confidence
Secure configuration via environment variables and Vault provider
The internal/envvar package now supports retrieving sensitive values from an external secret provider (such as Hashicorp Vault) instead of plain environment variables. When a configuration key has a corresponding \\<KEY\>\_SECURE\ environment variable set, the system uses the injected Provider interface to fetch the actual secret value; otherwise, it falls back to the standard environment variable. This change introduces the Provider interface, a Configuration struct that wraps it, and a FakeProvider for testing, allowing applications to securely manage secrets without hardcoding them.
internal/envvar · high confidence
Task service introduces circuit breaker and message broker integration
The task application service now integrates a circuit breaker pattern (using go-circuitbreaker) to protect search operations and publishes task lifecycle events (Created, Deleted, Updated) to a message broker. This change adds new interfaces for repository, search, and message broker dependencies, along with generated test fakes and corresponding unit tests to verify the service behavior.
internal/service · high confidence
Vault-based secret retrieval with local caching
The application now supports retrieving secrets from HashiCorp Vault via a new \internal/envvar/vault\ package. This component initializes a Vault client using a token and address, and provides a \Get\ method that fetches values from the KV engine using a colon-separated path and key format (e.g., \path:key\). It includes local in-memory caching to avoid repeated network calls for the same secret path, and returns specific errors for missing keys, invalid data, or unavailable secrets.
internal/envvar/vault · high confidence
Behavioural changes
Database schema and migration tooling updated
The database layer now uses the 'tern' tool for managing migrations instead of the previous system. Initial migrations define a 'tasks' table with UUID primary keys, description, priority, dates, and a done flag. The schema has been updated to use the native 'gen\_random\_uuid()' function for ID generation, removing the dependency on the 'uuid-ossp' extension.
db · high confidence
PostgreSQL data layer regenerated with sqlc v1.30.0 and pgx/v5
The internal PostgreSQL database access layer has been regenerated using sqlc v1.30.0, updating the generated Go code to use the jackc/pgx/v5 driver. This change affects the type-safe query implementations for tasks (insert, select, update, delete) and model definitions, ensuring compatibility with the newer pgx/v5 library and its associated types like pgtype.Timestamp.
internal/postgresql/db · high confidence
Test coverage
Added generated mock for TaskService in resttesting package
The internal/rest/resttesting package now includes a generated fake implementation of the TaskService interface (task\_service.gen.go), created using counterfeiter. This mock supports stubbing and verifying calls for service methods such as By, ByID, Create, Delete, and Update, enabling more robust unit testing of REST handlers that depend on task service operations.
internal/rest/resttesting · high confidence
Dependencies
Initialize Go module with Go 1.26 and core dependencies
The project initializes its Go module (github.com/MarioCarrion/todo-api-microservice-example) targeting Go 1.26. The main module includes dependencies for PostgreSQL (jackc/pgx/v5, jackc/tern/v2), caching (gomemcache, go-redis/v9), messaging (confluent-kafka-go/v2, amqp091-go), observability (go-elasticsearch/v7, zap), and security (hashicorp/vault/api). Tooling dependencies in internal/tools include golangci-lint/v2, oapi-codegen/v2, sqlc, and counterfeiter.
(dependencies) · high confidence
Written by cca.canine.dev from the codebase's own history, inside the signed delivery this page is composed from.
How this codebase got here
Score
- CAI 62 → 63 (+0.6)
- Rubric changed (rubric-2026.10.5 → rubric-2026.11.2) — scores are not directly comparable.
Lenses
- Code Health 81 → 81 (+0.0)
- Architecture 100 → 98 (-2.2)
- Maturity 69 → 72 (+3.2)
- Readiness 48 → 48 (-0.3)
- Security 86 → 85 (-1.9)
- Event-Driven 72 → 72 (+0.0)
New (13)
- High CVE: [GHSA redacted] (go.mod)
- Medium CVE: GO-2026-6865 (go.mod)
- Outdated: github.com/go-ozzo/ozzo-validation/v4
- Outdated: github.com/jackc/pgx/v5
- Outdated: github.com/oapi-codegen/runtime
- Outdated: github.com/testcontainers/testcontainers-go
- Outdated: github.com/testcontainers/testcontainers-go/modules/elasticsearch
- Outdated: github.com/testcontainers/testcontainers-go/modules/kafka
- Outdated: github.com/testcontainers/testcontainers-go/modules/postgres
- Outdated: github.com/testcontainers/testcontainers-go/modules/rabbitmq
- Outdated: github.com/testcontainers/testcontainers-go/modules/redis
- Outdated: github.com/testcontainers/testcontainers-go/modules/vault
- Scattered collaborators
Written by cca.canine.dev from the codebase's own history, inside the signed delivery this page is composed from.
Survey your own repository
MarioCarrion/todo-api-microservice-example was measured the same way every project in this corpus was: the same rubric, at a pinned commit, with the result published in full. Point a surveyor at a repository you know and see whether you agree with it.
About this page
- The score is its most recent published measurement, taken on 8 November 2026 at a pinned commit. It is not a live figure and does not change until the project is measured again.
- Measured at commit acb6a31ae934170a6231f1dc631f6ad1a5eb92b1 — the exact code this score is about.
- Scored under rubric-2026.11.2 — the same rubric and the same method as every other entry in this index.
- Measured by Canine Code Analyzer (cca.canine.dev) using cca measure-2026.11.3+preprod-45ab2cab63de.