Skip to content
CAI
Software that uses CAICheck a score

LucasRGoes/ports-adapters-sample

55.4

Adequate · 20 September 2026

1.3k

lines of production code

Python

primary language

4

measurements over time

CAI band scale
CAI trend line
CAI lens gauges

What this system is

This system is a book registration application built on a Ports and Adapters architecture, designed to manage book data through a clear separation of domain logic and external interfaces. It exposes functionality via HTTP endpoints using Flask and supports asynchronous messaging through MQTT, allowing for flexible command and event routing. Data persistence is handled by interchangeable adapters, specifically supporting both in-memory storage for lightweight operations and SQLite for durable, file-based records.

Features

Initial application structure with Ports and Adapters architecture

The application is initialized with a version of 0.1.0 and establishes a Ports and Adapters architecture. This includes domain models (Book), message definitions (RegisterBookCommand, BookRegisteredEvent), and abstract ports for repositories and senders. The entry point configures the application using a Builder pattern to instantiate adapters for databases (Memory, SQLite) and interfaces (MQTT, Flask), and sets up a Message Bus to handle command and event routing.

app · high confidence

New adapters for Flask, SQLite, MQTT, and in-memory storage

The application now includes a set of adapter implementations that bridge the core domain logic with external technologies. A Flask REST interface allows users to register and query books via HTTP endpoints, while an MQTT interface enables command and event handling over the MQTT protocol. For data persistence, the system provides both an in-memory storage adapter for lightweight operation and a SQLite adapter for durable, file-based storage, each implementing the necessary repository and unit-of-work patterns.

app/adapters · high confidence

Test coverage

Initial test suite for application adapters, domain ports, and handlers

Added a comprehensive set of unit and integration tests covering the application's core components. This includes tests for the memory and SQLite database adapters (saving books and querying by name/author), the MessageBus domain port (command/event handling and subscription logic), the RegisterBook and BookRegistered handlers, the MQTT sender, and the Flask and MQTT interfaces.

tests · 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 54 → 55 (+1.6)
  • Rubric changed (rubric-2026.08.17 → rubric-2026.09.15) — scores are not directly comparable.

Lenses

  • Code Health 98 → 99 (+0.7)
  • Architecture 69 → 69 (+0.0)
  • Maturity 67 → 66 (-0.3)
  • Readiness 31 → 38 (+7.4)
  • Security 100 → 76 (-24.5)

Resolved (9)

  • Coverage not included — suite not readable by the collector
  • Dependency hygiene not measured — no supported dependency manifest was read
  • Duplicated block (10–11 lines × 2) (app/adapters/sqlite.py)
  • No exposed public API
  • Test reliability not included
  • early-stage repository — too little history to judge knowledge freshness
  • git history depth insufficient
  • git history depth insufficient
  • single-maintainer — knowledge-concentration (bus factor) risk

New (37)

  • Critical CVE: [GHSA redacted] (requirements.txt)
  • Documentation: no contributor guidance (README.md)
  • Documentation: no installation or build instructions (README.md)
  • Documentation: no usage examples (README.md)
  • Duplicated block (10–11 lines × 2) (app/adapters/sqlite.py)
  • High CVE: [GHSA redacted] (requirements.txt)
  • High CVE: [GHSA redacted] (requirements.txt)
  • High CVE: [GHSA redacted] (requirements.txt)
  • High CVE: [GHSA redacted] (requirements.txt)
  • Hotspot: app/main.py (app/main.py)
  • Medium CVE: [GHSA redacted] (requirements.txt)
  • Medium CVE: [GHSA redacted] (requirements.txt)
  • Medium CVE: [GHSA redacted] (requirements.txt)
  • Medium CVE: [GHSA redacted] (requirements.txt)
  • Medium CVE: PYSEC-2026-2132 (requirements.txt)
  • No ADRs found
  • Outdated: aniso8601
  • Outdated: certifi
  • Outdated: chardet
  • Outdated: click
  • …and 17 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

LucasRGoes/ports-adapters-sample 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 20 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 7192ef724ceed9aa60c03ee3bda2a97a8b532298 — 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-28e75b8e3254.