Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
1 change: 1 addition & 0 deletions .superpowers/brainstorm/1598-1774461630/.server-stopped
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
{"reason":"idle timeout","timestamp":1774463491955}
1 change: 1 addition & 0 deletions .superpowers/brainstorm/1598-1774461630/.server.pid
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
1598
95 changes: 62 additions & 33 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,41 +1,70 @@
# RCommon

Open-source .NET infrastructure library providing battle-tested abstractions for persistence, CQRS, event handling, messaging, caching, and more. Swap providers (EF Core, Dapper, MediatR, MassTransit, Wolverine, Redis) without touching your domain code.

[![NuGet](https://img.shields.io/nuget/v/RCommon.Core?label=NuGet)](https://www.nuget.org/profiles/RCommon)
[![License](https://img.shields.io/github/license/RCommon-Team/RCommon)](LICENSE)

## Overview
RCommon is a cohesive set of libraries with abstractions for widely used implementations of design patterns, and architectural patterns which are common (see what we did there?) to many applications used today. The primary goals of this toolset are:
1. Future proofing applications against changing architectural or infrastructure needs.
2. Solve common problems under the presentation layer. Presentation frameworks are something else entirely. We try to keep everything nice under the hood. Cross cutting concerns, persistence strategies, transaction management, event handling, and messaging is where we want to shine.
3. Code testability. We try to limit the "magic" used. Things like dependency injection are used but in a very straightforward manner. Unit tests, and integration tests should be implemented to the highest degree possible. Afterall, we want the applications you build on top of this to work :)
4. Last but not least - open source using permissive Apache2.0 licensing forever.

We track bugs, enhancement requests, new feature requests, and general issues on [GitHub Issues](https://github.com/Reactor2Team/RCommon/issues "GitHub Issues") and are very responsive. General "how to" and community support should be managed on [Stack Overflow](https://stackoverflow.com/questions/tagged/rcommon "Stack Overflow").

## Patterns & Abstractions Utilized
* Specification
* Mediator
* Command Query Responsbility Segregation (CQRS)
* Validations
* Repository
* Unit Of Work
* Event Sourcing (Coming Soon)
* Event Bus
* Message Bus
* Caching
* Serialization
* Generic Factory
* Guard
* Data Transfer Objects (DTO)

## Pattern Implementations
* Mediator: MediatR
* Repository: Entity Framework Core, Dapper, Linq2Db
* Message Bus: MassTransit, Wolverine
* Email: SMTP, SendGrid
* Validation: FluentValidation
* Caching: MemoryCache, Redis, Valkey
* Serialization: JSON.NET, System.Text.Json

RCommon is a cohesive set of libraries with abstractions for widely used design patterns and architectural patterns which are common to many .NET applications. The primary goals are:

1. **Future-proof** applications against changing infrastructure needs — swap providers without rewriting domain code.
2. **Solve common problems** below the presentation layer: persistence, transaction management, event handling, messaging, caching, and cross-cutting concerns.
3. **Code testability** — straightforward dependency injection, minimal magic, high test coverage.
4. **Open source** — Apache 2.0 licensed, forever.

**Targets:** .NET 8, .NET 9, .NET 10

We track bugs, enhancement requests, and feature requests on [GitHub Issues](https://github.com/RCommon-Team/RCommon/issues) and are very responsive. Community support is available on [Stack Overflow](https://stackoverflow.com/questions/tagged/rcommon).

## Abstractions & Implementations

| Abstraction | What It Provides | Implementations |
|---|---|---|
| **Persistence** | Repository pattern (`ILinqRepository`, `IGraphRepository`, `ISqlMapperRepository`, `IAggregateRepository`), Unit of Work, Specifications, Transactional Outbox/Inbox, Sagas | Entity Framework Core, Dapper, Linq2Db |
| **CQRS & Mediator** | Command/Query Bus (`ICommandBus`, `IQueryBus`), Mediator (`IMediatorService`), pipeline behaviors | MediatR, Wolverine |
| **Event Handling** | In-memory event bus, distributed events, transactional outbox pattern | MediatR, MassTransit, Wolverine |
| **Messaging** | Message bus for distributed systems, send/publish semantics | MassTransit, Wolverine |
| **Caching** | Unified read-through cache (`ICacheService`), query-level cache-aside for repositories | MemoryCache, Redis (StackExchange) |
| **Blob Storage** | Container and blob CRUD, upload/download, presigned URLs, metadata, copy/move | Azure Blob Storage, Amazon S3 |
| **Domain-Driven Design** | Entities, Aggregate Roots (with optimistic concurrency), Domain Events, Value Objects, Auditing, Soft Delete | Built into `RCommon.Entities` |
| **Multi-Tenancy** | Tenant resolution and isolation, per-entity tenant markers | Finbuckle.MultiTenant |
| **State Machines** | Finite state machines (`IStateMachine`), saga state machines | Stateless, MassTransit (Automatonymous) |
| **Serialization** | Provider-agnostic JSON serialization (`IJsonSerializer`) | Newtonsoft.Json, System.Text.Json |
| **Validation** | Pluggable validation pipeline (`IValidationService`) | FluentValidation |
| **Email** | Unified email service (`IEmailService`) | SMTP, SendGrid |
| **Security** | Current user/tenant context, principal accessors, claims-based tenant resolution | ASP.NET Core, Swagger/Swashbuckle |

## Getting Started

All configuration flows through a single fluent builder chain:

```csharp
services.AddRCommon()
.WithPersistence<EFCorePerisistenceBuilder>(ef => ef
.AddDbContext<MyDbContext>("MyDb", options => ...))
.WithMediator<MediatRBuilder>(mediator => mediator
.AddCommand<MyCommand, MyCommandHandler>())
.WithEventHandling<MassTransitEventHandlingBuilder>(events => events
.AddProducer<PublishWithMassTransitEventProducer>())
.WithCaching<MemoryCachingBuilder>()
.WithSerialization<SystemTextJsonBuilder>();
```

Install only the packages you need:

```bash
dotnet add package RCommon.Core
dotnet add package RCommon.EfCore
dotnet add package RCommon.Mediatr
# ... and so on
```

## Documentation
We are maintaining and publishing our documentation at [https://docs.rcommon.com](https://docs.rcommon.com)

Full documentation is available at [https://rcommon.com](https://rcommon.com/docs)

## Stats

![Alt](https://repobeats.axiom.co/api/embed/79bab6079995bd0d448b0f69686e7c2c99a15224.svg "Repobeats analytics image")
Loading
Loading