Skip to content
CAI
Software that uses CAICheck a score

edo1z/rust-rocket-sqlx-sample

51.2

Adequate · 20 September 2026

882

lines of production code

Rust

primary language

4

measurements over time

CAI band scale
CAI trend line
CAI lens gauges

What this system is

This system is a Rust-based REST API service built on the Rocket framework and SQLx for PostgreSQL data persistence. It implements a layered architecture to manage user and product entities, providing full CRUD operations for users and basic creation and listing capabilities for products. The application includes structured error handling, dependency injection, and comprehensive test infrastructure to support unit and integration testing.

Features

Application restructured into layered architecture with new user and product endpoints

The application has been refactored from a flat structure into a layered architecture (controllers, use cases, repositories, models, DTOs) to improve separation of concerns. This change introduces dedicated REST endpoints for managing users (/users) and products (/products), replacing the previous single index route. The new structure supports full CRUD operations for users (create, read, update, delete) and basic creation and listing for products, leveraging a new dependency injection container (App) and mockable use-case interfaces to facilitate testing.

src · high confidence

Initial database schema for users and products

The application now includes the first database migration, which creates the initial schema. This adds a 'users' table and a 'products' table, each containing an auto-incrementing ID and a name field. A corresponding down migration is also provided to drop these tables if a rollback is required.

migrations · high confidence

Initial project scaffolding and documentation

This release introduces the initial structure for a Rust sample application using Rocket and SQLx. It includes a README with usage instructions, an MIT license, and a .env.example file defining database connection strings. The project now supports test database configuration via a new docker-compose service and a migration script, while .gitignore has been updated to exclude .env and .sqlx files.

(repo-wide) · high confidence

Introduce product and user repository layer with PostgreSQL integration

This change adds a new repository layer in src/repositories that provides data access for Product and User entities using PostgreSQL via sqlx. It introduces a shared error type (DbRepoError) wrapping serde\_json and sqlx errors, and defines traits (ProductRepo, UserRepo) with implementations (ProductRepoImpl, UserRepoImpl) that support create, find\_all, find\_by\_id, update, and delete operations. A Repos struct and create\_repos factory are added to aggregate these repositories. The implementation includes structured logging via tracing and unit tests for both repositories against a test database.

src/repositories · high confidence

Behavioural changes

Introduction of structured error handling and data models

This change introduces a centralized error handling system via \src/error/app\_error.rs\, defining specific error types (such as \BadRequest\, \NotFound\, and \DbError\) with automatic HTTP status code mapping and responder integration for the Rocket framework. It also adds helper macros (\app\_err\, \app\_err\_bail\, \app\_err\_ensure\) to simplify error propagation and a logging macro for error tracking. Additionally, the codebase now includes dedicated Data Transfer Objects (\src/dto/product\_dto.rs\, \src/dto/user\_dto.rs\) and database models (\src/models/user\_model.rs\, \src/models/product\_model.rs\) for Users and Products, with the Product model updated to use an integer ID instead of a UUID.

src/dto, src/error, src/models · high confidence

Test coverage

Added test infrastructure for repository and use-case testing

Added test support files in src/test to enable unit and integration testing of the application's core logic. This includes test fixtures for User and Product models, helper functions to create mock repositories and use cases for the App, and utilities to establish a test database connection. Additionally, helper functions were added to prepare test data by creating sample users and products via the repository implementations.

src/test · high confidence

Dependencies

Version bump to 0.2.0 with new testing and logging dependencies

The project has been renamed to rust-rocket-sqlx-sample and bumped to version 0.2.0. This update adds several new dependencies to support testing and observability: mockall (0.11) for mocking in tests, tracing and tracing-subscriber for structured logging, and thiserror for error handling. Additionally, the sqlx dependency now includes the 'json' feature, and the chrono crate is added with serde support.

(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 48 → 51 (+3.2)
  • Rubric changed (rubric-2026.08.17 → rubric-2026.09.15) — scores are not directly comparable.

Lenses

  • Code Health 100 → 100 (-0.2)
  • Architecture 69 → 69 (+0.0)
  • Maturity 80 → 85 (+5.5)
  • Readiness 18 → 25 (+6.8)
  • Security 100 → 88 (-11.8)
  • Domain Modelling 67 → 68 (+0.5)

Resolved (8)

  • Coverage not included — suite not readable by the collector
  • Dependency hygiene not measured — no supported dependency manifest was read
  • No exposed public API
  • Test reliability not included
  • early-stage repository — too few commits for a meaningful bus factor
  • early-stage repository — too little history to judge knowledge freshness
  • git history depth insufficient
  • git history depth insufficient

New (34)

  • Documentation: no installation or build instructions (README.md)
  • Duplicated block (9 lines × 2) (src/controllers/product_controller.rs)
  • High CVE: [GHSA redacted] (Cargo.lock)
  • High IaC: WD-COMPOSE-0002 (docker-compose.yml)
  • High IaC: WD-COMPOSE-0002 (docker-compose.yml)
  • High vulnerability: [GHSA redacted] (Cargo.lock)
  • High vulnerability: [GHSA redacted] (Cargo.lock)
  • Medium CVE: [GHSA redacted] (Cargo.lock)
  • Medium CVE: [GHSA redacted] (Cargo.lock)
  • Medium CVE: [GHSA redacted] (Cargo.lock)
  • Medium CVE: [GHSA redacted] (Cargo.lock)
  • Medium CVE: [GHSA redacted] (Cargo.lock)
  • Medium CVE: [GHSA redacted] (Cargo.lock)
  • Medium CVE: RUSTSEC-2024-0336 (Cargo.lock)
  • Medium CVE: RUSTSEC-2025-0055 (Cargo.lock)
  • Medium advisory (unmaintained): RUSTSEC-2021-0141 (Cargo.lock)
  • Medium advisory (unmaintained): RUSTSEC-2024-0384 (Cargo.lock)
  • Medium advisory (unmaintained): RUSTSEC-2024-0436 (Cargo.lock)
  • Medium advisory (unmaintained): RUSTSEC-2025-0010 (Cargo.lock)
  • Medium advisory (unmaintained): RUSTSEC-2025-0056 (Cargo.lock)
  • …and 14 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

edo1z/rust-rocket-sqlx-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 bdbb81b049ba8113ba2e3aa87f63d2eaba4f7de2 — 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.