ShawnShiSS/clean-architecture-azure-cosmos-db
41.4
Weak · 21 September 2026
3.8k
lines of production code
C#
with TypeScript
4
measurements over time
What this system is
Features
Add Azure Blob Storage and SendGrid email services
Users can now upload and retrieve files via a new Azure Blob Storage service, and the application can send transactional emails using the SendGrid integration. The diff introduces two new service implementations: \AzureBlobStorageService\ which implements \IStorageService\ to handle file uploads and stream retrieval, and \SendGridEmailService\ which implements \IEmailService\ to send messages via the SendGrid API.
src/CleanArchitectureCosmosDB.Infrastructure/Services · high confidence
Add generated API client for ToDoItem operations
The client application now includes a generated API client (ApiClientFactory and Resources) for interacting with the ToDoItem service. This adds the ability to perform CRUD operations (create, read, update, delete) against the backend API using the NSwag-generated TypeScript client, enabling the Todo List view page to fetch and manage items.
src/CleanArchitectureCosmosDB.ClientApp/src/helpers · high confidence
Add reusable UI components and a server-side data table for todo items
The application introduces several new React components to support the todo feature: an Alert component wrapping Material-UI's Alert, a LoadingProgress spinner, and a TextFieldWithFormikValidation for form inputs. Additionally, a new ToDoDataTable component is added, which implements a Material Table with server-side search, pagination, and sorting capabilities for displaying todo items.
src/CleanArchitectureCosmosDB.ClientApp/src/components · high confidence
Add specification pattern for querying and searching
The application now uses the Specification pattern to abstract query logic for Cosmos DB. This includes a new \CosmosDbSpecificationEvaluator\ to translate specifications into queries, and specific implementations such as \AuditFilterSpecification\ for filtering by entity ID, \ToDoItemSearchSpecification\ for title-based search with pagination and sorting, and \ToDoItemSearchAggregationSpecification\ for aggregated search results. These changes enable more structured and reusable data access logic.
src/CleanArchitectureCosmosDB.Core/Specifications · high confidence
Add storage service interface for file operations
A new IStorageService interface has been introduced in the core layer, defining contracts for uploading files and retrieving file streams. This establishes the abstraction for storage operations, allowing implementations (such as Azure Blob Storage) to be plugged in later.
src/CleanArchitectureCosmosDB.Core/Interfaces/Storage · medium confidence
Add strongly-typed configuration models for Azure Cosmos DB and SendGrid email
New strongly-typed configuration classes have been introduced to support structured app settings. CosmosDbSettings defines the Azure Cosmos DB connection details, including the endpoint URL, primary key, database name, and a list of container names with their partition keys. SendGridEmailSettings holds the SendGrid API key, sender email address, and sender name. These models enable dependency injection and structured configuration binding for these external services.
src/CleanArchitectureCosmosDB.Infrastructure/AppSettings · high confidence
Add token service provider configuration and identity documentation
The infrastructure layer now includes a new \TokenServiceProvider\ class to configure external identity providers (such as ASP.NET Core Identity or Identity Server) with settings for authority and password management paths. Additionally, a \README\_Identity.md\ file has been added to the Identity folder, providing step-by-step instructions for generating and applying Entity Framework Core migrations for the identity database.
src/CleanArchitectureCosmosDB.Infrastructure/Identity · high confidence
Added Todo List and Create views with server-side data table
The client application now includes a new Dashboard view, a Todo List view that links to a create page, and a Todo Create page with client-side validation. The Todo List view integrates a DataTable component that supports server-side searching, pagination, and sorting, while the Create page handles form submission, redirects on success, and displays generic server errors in a toaster notification.
src/CleanArchitectureCosmosDB.ClientApp/src/views · medium confidence
Added attachment upload and download capabilities
Introduced the \AttachmentModel\ data class and MediatR commands for uploading single and multiple files, as well as a query for downloading a single file. This adds the ability for users to store and retrieve attachments via the API.
src/CleanArchitectureCosmosDB.WebAPI/Models/Attachment · high confidence
Added core domain models for To-Do items and audit tracking
The application now includes new domain entities: a \ToDoItem\ model representing tasks with a title, category, and completion status, and an \Audit\ model for tracking entity changes. This introduces the foundational data structures required for managing to-do items and recording their history within the core layer.
CleanArchitectureCosmosDB.Core · high confidence
Added dashboard layout and sidebar navigation
Introduced a new DashboardLayout component that provides a consistent application shell featuring a top app bar with a menu toggle, notification badge, and title, alongside a collapsible left sidebar for navigation. The sidebar includes links to the Dashboard, Todo List, Reports, and other sections, enabling users to navigate between different parts of the client application.
src/CleanArchitectureCosmosDB.ClientApp/src/layouts · high confidence
Added email sending capability via new IEmailService interface
A new IEmailService interface has been introduced in the core layer, defining a SendEmailAsync method that accepts recipient email, name, subject, and message. This establishes the contract for sending emails, enabling the application to dispatch email notifications to users.
src/CleanArchitectureCosmosDB.Core/Interfaces/Email · high confidence
Added identity models for authentication and user management
The application now includes new domain models to support user identity and authentication flows. This includes an \ApplicationUser\ entity extending ASP.NET Identity, an \ApplicationDbContext\ for data access, and a set of authentication-related classes (\Token\, \TokenRequest\, \TokenResponse\) for handling login credentials and JWT tokens. Additionally, a \RefreshToken\ model has been introduced to manage token lifecycle and validity.
src/CleanArchitectureCosmosDB.Infrastructure/Identity/Models · high confidence
Added infrastructure extensions for database initialization and data seeding
New extension methods were added to the application builder to automatically ensure that the Cosmos DB container and Identity database are created if they do not exist. Additionally, the application now supports seeding sample data into the Todo container and initializing Identity data upon startup. A helper class for cache key generation was also introduced.
src/CleanArchitectureCosmosDB.Infrastructure/Extensions · high confidence
Added initial database migration for identity and refresh token tables
The application now includes the initial Entity Framework Core migration for the identity database schema. This migration creates the standard ASP.NET Core Identity tables (AspNetUsers, AspNetRoles, AspNetUserClaims, etc.) as well as a custom RefreshToken table, establishing the foundational data structure for user authentication and session management.
src/CleanArchitectureCosmosDB.Infrastructure/Identity/Migrations · high confidence
Added token authentication service for user login and JWT generation
The application now includes a new \ITokenService\ interface and \TokenService\ implementation in the infrastructure layer to handle user authentication. The \TokenService\ provides methods to validate user credentials (\Authenticate\, \IsValidUser\) and generate JWT tokens (\GenerateJwtToken\). Notably, the \RefreshToken\ method is currently a placeholder that throws \NotImplementedException\, and the logic for generating and storing refresh tokens has been temporarily commented out in the \Authenticate\ method, meaning only immediate access tokens are issued for now.
src/CleanArchitectureCosmosDB.Infrastructure/Identity/Services · high confidence
In-memory caching for To-Do items
A new InMemoryCachedToDoItemsService has been added to provide a non-distributed, in-memory cache for To-Do items. This service implements the ICachedToDoItemsService interface, allowing the application to store and retrieve To-Do items from memory with a sliding expiration of one day, improving performance by reducing repeated data fetches.
src/CleanArchitectureCosmosDB.WebAPI/Infrastructure/Services · high confidence
Initial WebAPI project scaffolding and configuration
The WebAPI project is introduced with a complete startup configuration, including Serilog logging, NSwag/Swagger integration, OData support, and in-memory caching. The application is configured to automatically create and seed the Identity database and Cosmos DB containers during development. Additionally, a new ApiModelValidationException class is added to handle validation errors, and the Authenticate command handler is implemented to manage token-based authentication.
src/CleanArchitectureCosmosDB.WebAPI · high confidence
Initialize React client application with routing and dashboard views
The client application has been initialized using Create React App with TypeScript, establishing the foundational structure for the user interface. This includes a main App component that configures client-side routing via react-router-dom, linking a Dashboard layout to specific views such as a Dashboard, a Todo List, and a Todo creation form. The entry point wraps the application in a BrowserRouter, and the public folder contains standard React templates and metadata files.
src/CleanArchitectureCosmosDB.ClientApp/src · high confidence
Initializes the React client application
The client application is bootstrapped using Create React App with TypeScript support, providing a standard development environment with scripts for starting the server, running tests, and building for production. A TypeScript configuration file (tsconfig.json) is added to enforce strict type checking and modern ES5/ES6+ compilation targets. Additionally, an NSwag configuration file is introduced to generate TypeScript client code from the API's Swagger/OpenAPI definition, enabling type-safe API interactions within the React app.
src/CleanArchitectureCosmosDB.ClientApp · high confidence
Introduce Azure Functions with Cosmos DB integration and structured logging
Adds a new Azure Functions project that integrates with Cosmos DB and provides structured logging via Serilog. The function (StarterFunction) demonstrates retrieving data from Cosmos DB and sending emails, supported by dependency injection, strongly-typed configuration, and logging setup in Startup.cs.
src/CleanArchitectureCosmosDB.AzureFunctions · high confidence
Introduce Cosmos DB client abstraction and container factory
The application now uses a new infrastructure layer for Azure Cosmos DB. A \CosmosDbContainer\ class wraps the underlying \Microsoft.Azure.Cosmos\ SDK, and a \CosmosDbContainerFactory\ manages the creation and caching of container instances. The factory also handles database and container creation if they do not exist, and configuration constants for container names are defined in \CosmosDbConfigConstants\.
src/CleanArchitectureCosmosDB.Infrastructure/CosmosDbData · high confidence
Introduce Cosmos DB repository implementations with audit logging and parameterized queries
The infrastructure layer now includes concrete repository implementations for Cosmos DB, including a base \CosmosDbRepository\ and specific repositories for \Audit\ and \ToDoItem\ entities. This change introduces automatic audit logging for all entity changes, ensuring every create, update, or delete operation is recorded in an 'Audit' container. Additionally, the \ToDoItemRepository\ demonstrates the use of parameterized SQL queries to safely retrieve items by category or title, mitigating SQL injection risks associated with raw query strings.
src/CleanArchitectureCosmosDB.Infrastructure/CosmosDbData/Repository · high confidence
Introduce abstractions for Cosmos DB container management
Added new interfaces to the infrastructure layer to define the contract for managing Azure Cosmos DB containers. The update introduces IContainerContext for container-level context and partition key resolution, ICosmosDbContainer to wrap the Azure SDK Container instance, and ICosmosDbContainerFactory to handle container retrieval and database setup. These changes establish the foundational abstractions for Cosmos DB client and partitioning support.
src/CleanArchitectureCosmosDB.Infrastructure/CosmosDbData/Interfaces · medium confidence
Introduce base entity class for domain models
A new base class, BaseEntity, has been added to the core domain layer. This class provides a common structure for all entity models by defining a virtual Id property, establishing a consistent foundation for data entities within the application.
src/CleanArchitectureCosmosDB.Core/Entities · high confidence
Introduce cached to-do items service interface
A new interface, ICachedToDoItemsService, has been added to the core layer to manage cached to-do items. This interface defines methods for retrieving, deleting, and setting cached to-do items, enabling a caching mechanism for to-do list operations.
src/CleanArchitectureCosmosDB.Core/Interfaces/Cache · high confidence
New API endpoints for ToDo items, attachments, and authentication
The API now exposes controllers for managing ToDo items, file attachments, and user authentication. Users can perform full CRUD operations on ToDo items, including a search endpoint and an audit history view. File uploads (single and multiple) and downloads are supported via the Attachment controller. Additionally, a Token controller provides an authentication endpoint to obtain access tokens.
src/CleanArchitectureCosmosDB.WebAPI/Controllers · high confidence
To-Do Item API endpoints with validation and search
The API now exposes full CRUD operations for To-Do Items, including creating, updating, deleting, and retrieving individual or all items. A new search endpoint supports pagination, sorting, and title filtering. Validation rules enforce that titles are unique across all items, and the update operation also validates title uniqueness while allowing the current item to retain its title.
src/CleanArchitectureCosmosDB.WebAPI/Models/ToDoItem · high confidence
API
Introduce generic repository and audit interfaces for persistence
Added new interfaces to the persistence layer: a generic \IRepository\<T\>\ that defines standard CRUD operations (add, update, delete, get by ID, and get by specification) along with a raw query method, and specific repository interfaces for \Audit\ and \ToDoItem\ entities. This establishes the core abstraction for data access, supporting both specification-based queries and direct SQL-style queries.
src/CleanArchitectureCosmosDB.Core/Interfaces/Persistence · high confidence
Behavioural changes
API now returns structured error responses for common exceptions
A new ApiExceptionFilterAttribute has been added to the API infrastructure. This filter intercepts specific exceptions (ApiModelValidationException, EntityNotFoundException, EntityAlreadyExistsException, and InvalidCredentialsException) and converts them into standardized HTTP error responses (400, 401, 404, 409/400) with detailed problem descriptions. Additionally, the filter includes logic to handle invalid model states, ensuring that validation errors are also returned as structured 400 Bad Request responses.
src/CleanArchitectureCosmosDB.WebAPI/Infrastructure/Filters · medium confidence
Add MediatR pipeline behaviors for validation and exception handling
New MediatR pipeline behaviors have been introduced to the API's request processing pipeline. The ValidationBehaviour automatically runs FluentValidation validators on incoming requests, throwing an ApiModelValidationException if any validation errors are present. Additionally, the UnhandledExceptionBehaviour wraps all requests to catch and log any unhandled exceptions, ensuring consistent error handling and logging via Serilog.
src/CleanArchitectureCosmosDB.WebAPI/Infrastructure/Behaviours · high confidence
Add identity role and default password constants
A new constants file, ApplicationIdentityConstants.cs, has been added to the core layer. It defines two identity roles, 'Administrator' and 'Member', along with a default password value.
src/CleanArchitectureCosmosDB.Core/Constants · medium confidence
Added custom exception types for entity and authentication errors
The application now includes three new custom exception classes—EntityAlreadyExistsException, EntityNotFoundException, and InvalidCredentialsException—allowing the system to handle specific error conditions with greater precision. Users interacting with the API will receive more granular error handling for scenarios such as duplicate entities, missing resources, or invalid login credentials.
src/CleanArchitectureCosmosDB.Core/Exceptions · high confidence
Added design-time DbContext factory for initial database setup
A new design-time context factory has been introduced to support initial database creation and migrations. This includes a partial class for the application's DbContext that configures SQL Server options, and a factory class that reads the 'CleanArchitectureIdentity' connection string from appsettings.json to provide a DbContext instance for design-time tools.
src/CleanArchitectureCosmosDB.Infrastructure/Identity/DesignTime · medium confidence
Added identity data seeder for initial admin user and roles
A new seeder class, ApplicationDbContextDataSeed, has been added to the Identity/Seed folder. This component initializes the Identity database by creating default roles (Administrator, Member) and a pre-configured admin user account ([e-mail redacted]) with the default password, ensuring the application starts with necessary identity data.
src/CleanArchitectureCosmosDB.Infrastructure/Identity/Seed · high confidence
Centralized API configuration via dedicated extension methods
The WebAPI project now organizes its startup logic into dedicated configuration files (Authentication, Authorization, Caching, Database, MediatR, MVC, OData, and Swagger). This refactors the application's initialization by extracting service registrations—such as JWT authentication, in-memory caching, Cosmos DB and Identity database contexts, MediatR pipelines, MVC filters, OData support, and Swagger UI security headers—into modular, reusable extension methods. Users benefit from a cleaner, more maintainable startup process where each subsystem is configured independently.
src/CleanArchitectureCosmosDB.WebAPI/Config · high confidence
Upgrade to .NET 5 and Azure Functions v4
All projects in the solution have been updated to .NET 5, and the Azure Functions project has been upgraded to the newest v4. The README has been updated to reflect these changes and to document new features such as a React client application, auditing, and a custom token service provider.
(repo-wide) · high confidence
Test coverage
Added unit tests for the ToDoItem entity
Added a new unit test file for the ToDoItem entity, specifically verifying the behavior of the MarkComplete method and the IsCompleted property.
tests · high confidence
Dependencies
38 commits updating dependencies (7 manifests)
A dependency / build maintenance change in (dependencies) — 38 commits, 7 files.
(dependencies) · medium confidence · unverified
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 43 → 41 (-1.8)
- Rubric changed (rubric-2026.08.18 → rubric-2026.09.15) — scores are not directly comparable.
Lenses
- Code Health 54 → 53 (-0.7)
- Architecture 84 → 84 (+0.0)
- Maturity 56 → 56 (+0.0)
- Readiness 24 → 23 (-1.1)
- Security 59 → 63 (+3.2)
Resolved (63)
- Bounded contexts not declared
- Build did not complete in the analyzer
- Coverage not measured — analyzer environment
- Critical CVE: [GHSA redacted] (src/CleanArchitectureCosmosDB.ClientApp/yarn.lock)
- Critical CVE: [GHSA redacted] (src/CleanArchitectureCosmosDB.ClientApp/yarn.lock)
- Critical CVE: [GHSA redacted] (src/CleanArchitectureCosmosDB.ClientApp/yarn.lock)
- Critical CVE: [GHSA redacted] (src/CleanArchitectureCosmosDB.ClientApp/yarn.lock)
- Critical CVE: [GHSA redacted] (src/CleanArchitectureCosmosDB.ClientApp/yarn.lock)
- Critical CVE: [GHSA redacted] (src/CleanArchitectureCosmosDB.ClientApp/yarn.lock)
- Critical CVE: [GHSA redacted] (src/CleanArchitectureCosmosDB.ClientApp/yarn.lock)
- Critical CVE: [GHSA redacted] (src/CleanArchitectureCosmosDB.ClientApp/yarn.lock)
- Critical CVE: [GHSA redacted] (src/CleanArchitectureCosmosDB.ClientApp/yarn.lock)
- Critical CVE: [GHSA redacted] (src/CleanArchitectureCosmosDB.ClientApp/yarn.lock)
- Critical CVE: [GHSA redacted] (src/CleanArchitectureCosmosDB.ClientApp/yarn.lock)
- Critical CVE: [GHSA redacted] (src/CleanArchitectureCosmosDB.ClientApp/yarn.lock)
- Critical CVE: [GHSA redacted] (src/CleanArchitectureCosmosDB.ClientApp/yarn.lock)
- Critical CVE: [GHSA redacted] (src/CleanArchitectureCosmosDB.ClientApp/yarn.lock)
- Critical CVE: [GHSA redacted] (src/CleanArchitectureCosmosDB.ClientApp/yarn.lock)
- Critical CVE: [GHSA redacted] (src/CleanArchitectureCosmosDB.ClientApp/yarn.lock)
- Critical CVE: [GHSA redacted] (src/CleanArchitectureCosmosDB.ClientApp/yarn.lock)
- …and 43 more
New (135)
- Critical CVE: [GHSA redacted] (src/CleanArchitectureCosmosDB.ClientApp/yarn.lock)
- Critical CVE: [GHSA redacted] (src/CleanArchitectureCosmosDB.ClientApp/yarn.lock)
- Critical CVE: [GHSA redacted] (src/CleanArchitectureCosmosDB.ClientApp/yarn.lock)
- Critical CVE: [GHSA redacted] (src/CleanArchitectureCosmosDB.ClientApp/yarn.lock)
- Critical CVE: [GHSA redacted] (src/CleanArchitectureCosmosDB.ClientApp/yarn.lock)
- Critical CVE: [GHSA redacted] (src/CleanArchitectureCosmosDB.ClientApp/yarn.lock)
- Critical CVE: [GHSA redacted] (src/CleanArchitectureCosmosDB.ClientApp/yarn.lock)
- Critical CVE: [GHSA redacted] (src/CleanArchitectureCosmosDB.ClientApp/yarn.lock)
- Critical CVE: [GHSA redacted] (src/CleanArchitectureCosmosDB.ClientApp/yarn.lock)
- Critical CVE: [GHSA redacted] (src/CleanArchitectureCosmosDB.ClientApp/yarn.lock)
- Critical CVE: [GHSA redacted] (src/CleanArchitectureCosmosDB.ClientApp/yarn.lock)
- Critical CVE: [GHSA redacted] (src/CleanArchitectureCosmosDB.ClientApp/yarn.lock)
- Critical CVE: [GHSA redacted] (src/CleanArchitectureCosmosDB.ClientApp/yarn.lock)
- Critical CVE: [GHSA redacted] (src/CleanArchitectureCosmosDB.ClientApp/yarn.lock)
- Critical CVE: [GHSA redacted] (src/CleanArchitectureCosmosDB.ClientApp/yarn.lock)
- Critical CVE: [GHSA redacted] (src/CleanArchitectureCosmosDB.ClientApp/yarn.lock)
- Critical CVE: [GHSA redacted] (src/CleanArchitectureCosmosDB.ClientApp/yarn.lock)
- Critical CVE: [GHSA redacted] (src/CleanArchitectureCosmosDB.ClientApp/yarn.lock)
- Critical CVE: [GHSA redacted] (src/CleanArchitectureCosmosDB.ClientApp/yarn.lock)
- Critical CVE: [GHSA redacted] (src/CleanArchitectureCosmosDB.ClientApp/yarn.lock)
- …and 115 more
API surface
- Unchanged — 11 HTTP endpoints
Architecture
- Unchanged — 2 containers · 1 contexts · 0 edges
Written by watchdog.canine.dev from the codebase's own history, inside the signed delivery this page is composed from.
Survey your own repository
ShawnShiSS/clean-architecture-azure-cosmos-db 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 f8a0105c9ce46c25a980b09ad6eb3649f1f44416 — 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.