Skip to content
CAI
Software that uses CAICheck a score

thangchung/go-coffeeshop

54.3

Adequate · 21 September 2026

3.2k

lines of production code

Go

with JavaScript

4

measurements over time

CAI band scale
CAI trend line
CAI lens gauges

What this system is

This system is a Go-based microservices architecture for a coffee shop point-of-sale application, comprising distinct services for product management, order processing, and kitchen/barista operations. It leverages gRPC and HTTP gateways for service communication, with RabbitMQ handling asynchronous event-driven workflows between the counter, barista, and kitchen services. The backend persists order and item data in PostgreSQL, while a web frontend provides the user interface for placing orders.

Features

Add Dockerfiles for microservices and web frontend

New Dockerfiles are introduced for the barista, counter, kitchen, product, proxy, and web services. Each service is built using a multi-stage Go build process targeting Linux/AMD64, with the final image being a minimal scratch container. The proxy, counter, and web services expose ports 5000, 5002, and 8888 respectively, while the other services are configured to run their respective binaries.

docker · high confidence

Add PostgreSQL and gRPC infrastructure for the Counter service

The Counter service now includes new infrastructure components to persist order data and communicate with the Product service. This includes generated SQL queries and models for PostgreSQL (using sqlc v1.16.0) to handle order and line item operations, as well as a gRPC client implementation to interact with the Product service. Additionally, event publishers for Barista and Kitchen workflows have been added to the infrastructure layer.

internal/counter/infras · high confidence

Add Postgres database client with configurable connection options

A new Postgres client implementation is introduced in the pkg/postgres package, providing a DBEngine interface and a postgres struct that manages database connections. The client supports configurable connection attempts and timeouts via functional options, and exposes methods to retrieve the underlying \*sql.DB instance and close the connection.

pkg/postgres · high confidence

Add RabbitMQ connection logic with retry and backoff

A new file, pkg/rabbitmq/rabbitmq.go, introduces the core logic for connecting to RabbitMQ. The implementation includes a connection function that attempts to establish a connection, with a retry mechanism that backs off for 2 seconds between attempts, up to 5 retries before failing.

pkg/rabbitmq · high confidence

Add RabbitMQ consumer implementation with dependency injection support

Added a new RabbitMQ consumer implementation in the \pkg/rabbitmq/consumer\ package. The change introduces a \consumer\ struct that handles message consumption from a RabbitMQ queue, including exchange and queue declaration, binding, and message processing via a configurable worker pool. The implementation uses the \github.com/rabbitmq/amqp091-go\ library and integrates with Go's standard \context\ and \slog\ packages. A \wire.NewSet\ is provided for dependency injection, allowing the consumer to be instantiated with an existing AMQP connection. The consumer supports configuration options for exchange name, queue name, binding key, consumer tag, and worker pool size.

pkg/rabbitmq/consumer · high confidence

Add application configuration structures

The application now supports configuration for App (name, version), HTTP (host, port), and Log (level) settings, each with corresponding environment variable and YAML mapping.

pkg/config · medium confidence

Add local development environment for Nomad, Consul, and Traefik

Added configuration files to provision a local development environment using HashiCorp Nomad and Consul, along with Traefik for routing. This includes a start script to launch services, HCL job definitions for each application (barista, counter, product, kitchen, grpc-gw, web) and infrastructure components (postgres, rabbitmq, traefik), and a Terraform manifest to manage their deployment order.

build · high confidence

Add utility to detect Docker container execution

A new utility function IsRunningInContainer has been added to pkg/utils. This function checks for the presence of the /.dockerenv file to determine if the application is running inside a Docker container, returning true if detected.

pkg/utils · high confidence

Added Go tools for gRPC and SQLC code generation

Added a new 'tools' package that imports the gRPC-Gateway, OpenAPI v2, SQLC, and Go protobuf code generators. This change enables the project to generate Go code from .proto and SQL definitions, supporting the backend's API and database layers.

tools · medium confidence

Added PostgreSQL repository layer for kitchen orders

The application now includes a new database access layer for the kitchen domain, generated via sqlc v1.16.0. This introduces the \postgresql\ package containing models (\KitchenKitchenOrder\), a database interface (\DBTX\), and a \Queries\ struct that executes the \CreateOrder\ SQL statement to insert new kitchen order records into the \kitchen.kitchen\_orders\ table.

internal/kitchen/infras · high confidence

Added configuration and entry points for counter and kitchen services

The counter and kitchen services now include dedicated configuration files (config.yml) and Go packages (config/config.go) that load settings for PostgreSQL, RabbitMQ, and HTTP servers. The main entry points (main.go) initialize these services, connect to the database and message broker, and start gRPC servers, enabling the services to operate with externalized configuration.

cmd/counter · high confidence

Added gRPC and HTTP API contracts for Counter and Product services

New Protocol Buffers definitions and generated Go code introduce the \CounterService\ and \ProductService\ APIs. The \CounterService\ exposes endpoints to list order fulfillments and place orders, while the \ProductService\ provides methods to retrieve item types and list items by type. These changes add the underlying service definitions, data models (such as \OrderDto\, \ItemDto\), and the corresponding gRPC and HTTP gateway handlers required to expose these features.

proto · high confidence

Added in-memory product catalog with gRPC and HTTP access

The product service now exposes a product catalog via gRPC and HTTP endpoints. The catalog is backed by an in-memory repository containing predefined items (such as Cappuccino, Espresso, and various pastries) with associated names, types, prices, and image paths. This allows clients to retrieve item types and specific items by type through the new gRPC server and associated use-case layer.

internal/product · high confidence

Added shared kernel and event definitions for domain modeling

Introduced a shared kernel package containing base types for domain events, aggregates, and entities, alongside enumerations for order status, location, and item types. This provides the foundational building blocks for the internal domain model, enabling consistent event handling and state management across services like barista and kitchen.

internal/pkg · high confidence

Barista service gains event-driven order processing with PostgreSQL persistence

The barista service now processes 'barista-order-created' events from RabbitMQ, handling them via a new event handler that persists orders to PostgreSQL using sqlc-generated queries. The implementation includes a domain model for barista orders, an event handler that writes to the database and publishes domain events to the counter service, and a dependency injection setup via Google Wire to manage database and RabbitMQ connections.

internal/barista · high confidence

Initial database migrations for order, barista, and kitchen schemas

Added database migration files to initialize the 'order', 'barista', and 'kitchen' schemas in PostgreSQL. The 'order' schema includes tables for orders and line items, the 'barista' schema contains a table for barista orders, and the 'kitchen' schema includes a table for kitchen orders, each with appropriate indexes and foreign key constraints.

db · high confidence

Initial devcontainer configuration for Go development

Added a new .devcontainer directory containing the configuration files (Dockerfile-dev, core-libs.sh, devcontainer.json) that establish the local development environment. This setup installs Go 1.19.4, installs essential CLI tools (Buf, migrate, Consul, Nomad, Vault), and configures VS Code with Go-specific settings, extensions, and debugging options to streamline the developer workflow.

.devcontainer · high confidence

Initial project scaffolding and infrastructure configuration

The repository has been initialized with core configuration files that define the development and deployment environment. This includes a Makefile with targets for running services (product, counter, barista, kitchen, proxy, web) and Docker Compose files for container orchestration. The setup also introduces gRPC code generation via Buf, SQL code generation via sqlc, and a Go linter configuration (golangci-lint). Additionally, standard repository files like .gitignore, .dockerignore, and a MIT license have been added to support the project's structure.

(repo-wide) · high confidence

Initial web-based POS interface for CoffeeShop

The \cmd/web\ directory now contains a complete, self-contained web application for a coffee shop point-of-sale system. This includes the Go server (\main.go\) that serves static assets and proxies API calls, an HTML template (\index.html\) with a sidebar navigation and product/order views, a JavaScript controller (\script.js\) managing cart state and API interactions, and CSS styles (\style.css\) for the UI. The application is configured via environment variables for the backend URL and port, and it serves a functional frontend for browsing items, managing a shopping cart, and placing orders.

cmd/web · high confidence

Introduce Barista service configuration and entry point

The Barista service now includes a YAML-based configuration file (config.yml) and a Go config package that reads application, HTTP, PostgreSQL, and RabbitMQ settings. The main entry point initializes the application using these configurations, sets up logging with Logrus, and configures RabbitMQ exchanges and queues for order processing.

cmd/barista · high confidence

Introduce RabbitMQ publisher with configurable exchange and routing key

The codebase now includes a new RabbitMQ publisher implementation located in pkg/rabbitmq/publisher. This change introduces an EventPublisher interface and a concrete publisher struct that handles publishing messages to a RabbitMQ exchange. The publisher is configured with default values for exchange name ('orders-exchange'), binding key ('orders-routing-key'), and message type name ('ordered'), but these can be overridden using functional options (ExchangeName, BindingKey, MessageTypeName). The implementation uses Google Wire for dependency injection, providing a NewPublisher constructor that accepts an AMQP connection and returns the publisher. The Publish method sends messages with persistent delivery mode and unique IDs, while PublishEvents marshals events to JSON before publishing.

pkg/rabbitmq/publisher · medium confidence

Introduce configurable reverse-proxy server with gRPC-Gateway integration

The proxy application now starts an HTTP server that acts as a reverse proxy, routing requests to backend gRPC services (product and counter) via gRPC-Gateway. Configuration for the HTTP listener and gRPC endpoints is externalized into a new \config.yml\ file and loaded by \config.go\, allowing runtime customization of host, port, and log levels. The main entry point wires up CORS headers, logging, and the generated service handlers, enabling the proxy to forward REST/JSON traffic to the underlying gRPC services.

cmd/proxy · high confidence

Introduce domain models and order creation logic for the counter service

Added new domain files for the counter service, including the Order aggregate, LineItem, and supporting models (PlaceOrderModel, OrderItemModel, ItemModel). The Order aggregate now supports creating orders from a request, handling both barista and kitchen items, and applying domain events. A new interface ProductDomainService is defined for fetching items by type, and error handling is introduced with ErrItemNotFound.

internal/counter/domain · high confidence

Introduce new product service entry point and configuration

The product service is now bootstrapped with a dedicated configuration file (config.yml) and a Go-based config loader that reads application, HTTP, and logging settings. The main entry point initializes the gRPC server, sets up structured logging with Logrus and slog, and starts listening on the configured host and port (default 5001). This establishes the runtime environment for the product service.

cmd/product · high confidence

Kitchen service introduces domain model and event handling for order processing

The kitchen service now includes a domain model for kitchen orders, defining how items are processed with simulated preparation delays. An event handler listens for 'kitchen-order-created' messages from RabbitMQ, processes the order by saving it to PostgreSQL, and publishes domain events to the counter service. The application is wired using Google Wire for dependency injection, and a database migration utility is provided for Postgres.

internal/kitchen · high confidence

Behavioural changes

Added Logrus adapter for Go's standard slog interface

A new LogrusHandler was added to bridge Go's standard library slog logging interface with the existing Logrus logger. This adapter translates slog records and attributes into Logrus log entries, enabling the application to use the standard library's structured logging API while still routing output through Logrus.

pkg/logger · high confidence

Refactored the Counter service to use dependency injection and event-driven architecture

The Counter service has been refactored to use Google Wire for dependency injection, introducing a new \App\ struct that manages connections to PostgreSQL and RabbitMQ. This change introduces event handlers for \BaristaOrderUpdated\ and \KitchenOrderUpdated\ events, allowing the counter service to process order updates from the barista and kitchen services. The \PlaceOrder\ use case now publishes domain events to RabbitMQ, decoupling order creation from downstream processing. Additionally, a new gRPC server implementation (\counter\_grpc\_server.go\) handles \GetListOrderFulfillment\ and \PlaceOrder\ requests, wired via the new DI container.

internal/counter · high confidence

Dependencies

Initial Go module and dependency setup

The project now includes a go.mod and go.sum file, establishing the Go module path and declaring direct dependencies such as gRPC, Echo, sqlc, and RabbitMQ, along with their indirect dependencies.

(dependencies) · high confidence

Written by watchdog.canine.dev from the codebase's own history, inside the signed delivery this page is composed from.

How this codebase got here

Score

  • CAI 53 → 54 (+1.2)
  • Rubric changed (rubric-2026.08.19 → rubric-2026.09.15) — scores are not directly comparable.

Lenses

  • Code Health 95 → 93 (-1.1)
  • Architecture 100 → 95 (-5.1)
  • Maturity 56 → 56 (+0.0)
  • Readiness 40 → 43 (+3.3)
  • Security 86 → 77 (-8.8)
  • Domain Modelling 79 → 81 (+2.6)
  • Event-Driven 80 → 80 (+0.0)
  • Accessibility 57 → 57 (+0.0)

Resolved (35)

  • Coverage not included — suite not readable by the collector
  • Critical CVE: [GHSA redacted] (go.mod)
  • Critical CVE: [GHSA redacted] (go.mod)
  • Dependency hygiene not measured — dependency manifest found but not parsed for hygiene
  • Duplicated block (10 lines × 2) (internal/counter/app/app.go)
  • Duplicated block (11 lines × 2) (cmd/counter/main.go)
  • Duplicated block (11 lines × 2) (internal/barista/eventhandlers/barista_ordered.go)
  • Duplicated block (11 lines × 2) (internal/barista/eventhandlers/barista_ordered.go)
  • Duplicated block (11 lines × 2) (internal/counter/infras/repo/orders_postgres.go)
  • Duplicated block (12 lines × 2) (internal/barista/eventhandlers/barista_ordered.go)
  • Duplicated block (12 lines × 2) (internal/counter/events/handlers/barista_order_updated.go)
  • Duplicated block (12 lines × 4) (cmd/barista/main.go)
  • Duplicated block (13 lines × 2) (cmd/barista/main.go)
  • Duplicated block (14 lines × 2) (cmd/barista/config/config.go)
  • Duplicated block (15 lines × 3) (cmd/kitchen/config/config.go)
  • Duplicated block (17 lines × 2) (internal/barista/app/app.go)
  • Duplicated block (6 lines × 2) (internal/counter/domain/order.go)
  • Duplicated block (8 lines × 2) (internal/counter/infras/repo/orders_postgres.go)
  • High CVE: [GHSA redacted] (go.mod)
  • High CVE: [GHSA redacted] (go.mod)
  • …and 15 more

New (89)

  • Critical CVE: [GHSA redacted] (go.mod)
  • Critical CVE: [GHSA redacted] (go.mod)
  • Critical CVE: [GHSA redacted] (go.mod)
  • Dependency pinned to a stale untagged commit: golang.org/x/exp
  • Dependency pinned to a stale untagged commit: google.golang.org/genproto
  • Documentation: no usage examples (README.md)
  • Duplicated block (11 lines × 2) (internal/barista/eventhandlers/barista_ordered.go)
  • Duplicated block (11 lines × 3) (internal/barista/eventhandlers/barista_ordered.go)
  • Duplicated block (12 lines × 2) (internal/barista/app/app.go)
  • Duplicated block (12 lines × 2) (internal/barista/eventhandlers/barista_ordered.go)
  • Duplicated block (12 lines × 4) (internal/barista/app/app.go)
  • Duplicated block (13 lines × 2) (internal/barista/eventhandlers/barista_ordered.go)
  • Duplicated block (15 lines × 3) (internal/barista/app/app.go)
  • Duplicated block (16 lines × 2) (internal/counter/infras/repo/orders_postgres.go)
  • Duplicated block (17 lines × 2) (internal/barista/app/app.go)
  • Duplicated block (18 lines × 2) (cmd/barista/config/config.go)
  • Duplicated block (20 lines × 2) (internal/counter/events/handlers/barista_order_updated.go)
  • Duplicated block (21 lines × 4) (cmd/barista/main.go)
  • Duplicated block (22 lines × 2) (cmd/barista/config/config.go)
  • Duplicated block (22 lines × 3) (cmd/kitchen/config/config.go)
  • …and 69 more

Written by watchdog.canine.dev from the codebase's own history, inside the signed delivery this page is composed from.

Survey your own repository

thangchung/go-coffeeshop 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 21 September 2026 at a pinned commit. It is not a live figure and does not change until the project is measured again.
  • Measured at commit 22d33190a0cf81630878e47bafae2de7c0abb783 — the exact code this score is about.
  • Scored under rubric-2026.09.15 — the same rubric and the same method as every other entry in this index.
  • Measured by watchdog.canine.dev using codehealth-analyzer preprod-fa71c66cabd8.