Clean Architecture Azure Cosmos Db

screenshot of Clean Architecture Azure Cosmos Db
react
material-ui

A starting point to build a web API to work with Azure Cosmos DB using .NET 5 and Azure Cosmos DB .NET SDK V3, based on Clean Architecture and repository design pattern. Partition key is also implemented through the repository pattern.

Overview:

This project provides a starting point for building a web API to work with Azure Cosmos DB using .NET 5 and Azure Cosmos DB .NET V3. It follows the Clean Architecture and repository design pattern, and also implements the partition key for large scale Cosmos DB. The project includes a RESTful API application, an Azure Functions project, an auditing feature, and a React Client Web Application. It aims to provide a basic solution structure for anyone building an ASP.NET Core web or API project using Cosmos DB.

Features:

  • Clean Architecture and repository design pattern: The project follows the recommended Clean Architecture and repository design pattern for building ASP.NET Core web or API projects.
  • Azure Cosmos DB integration: The project uses Azure Cosmos DB and the newer Cosmos DB .NET SDK V3 to interact with Cosmos DB, including support for stream APIs and Cosmos DB Change Feed processor APIs.
  • Partition key implementation: The project implements the partition key through the repository pattern to support large scale Cosmos DB.
  • Azure Functions project: An Azure Functions project is included, demonstrating how it can be used as a serverless compute service to work with Cosmos DB.
  • Auditing feature: The project includes a default Audit container that is created at API startup. Auditing is done through the repository automatically when updating an item, with no code change required in the API project. An example API endpoint is added to demonstrate how to retrieve the full history of an entity.
  • React Client Web Application: A web application dashboard built using React, Typescript, and Material UI is included. It uses NSwagStudio to generate TypeScript client code to interact with the API. FluentValidation is registered to define validation rules in the Swagger/OpenAPI schema.
  • Token Service Provider: The project includes a custom token service provider using ASP.NET Core Identity and SQL Server.

Summary:

This project provides a comprehensive solution structure for building ASP.NET Core web or API projects using Azure Cosmos DB. It follows the Clean Architecture and repository design pattern and includes features such as partition key implementation, Azure Functions integration, auditing, and a React Client Web Application. With the use of the newer Cosmos DB .NET SDK V3, the project offers improved performance and support for stream APIs and Cosmos DB Change Feed processor APIs. Overall, this project serves as a valuable starting point for developers looking to work with Azure Cosmos DB in their .NET projects.

react
React

React is a widely used JavaScript library for building user interfaces and single-page applications. It follows a component-based architecture and uses a virtual DOM to efficiently update and render UI components

material-ui
Material UI

material-ui adds classes to Tailwind CSS for all common UI components. Classes like btn, card, etc. This allows us to focus on important things instead of making basic elements for every project.

typescript
Typescript

TypeScript is a superset of JavaScript, providing optional static typing, classes, interfaces, and other features that help developers write more maintainable and scalable code. TypeScript's static typing system can catch errors at compile-time, making it easier to build and maintain large applications.