Skip to content

ekinbulut/codewave-roots-framework

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

17 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Roots.Framework

License: MIT

Roots.Framework is a modular .NET library providing foundational building blocks for enterprise applications, including CQRS, unit of work, repository patterns, middleware, JWT authentication, HTTP/RabbitMQ clients, and more.

Features

  • CQRS Support: Command and Query interfaces, MediatR integration, pipeline behaviors (logging, trace ID, exception handling).
  • Persistence Layer: Generic repository and unit of work patterns for Entity Framework Core.
  • Middleware: Error handling, logging with transaction IDs, and request culture support.
  • Security: JWT token generation/validation and cryptographic helpers.
  • External Integrations: HTTP client abstraction (RestSharp) and RabbitMQ messaging client.
  • Configuration Extensions: Easy DI registration for all features.

Project Structure

Roots.Framework/
├── Common/Exceptions/         # Custom exception types
├── Configuration/             # Service registration extensions
├── CQRS/                      # CQRS interfaces and pipeline behaviors
├── Externals/
│   ├── Http/                  # HTTP client abstraction
│   └── Messaging/             # RabbitMQ client abstraction
├── Middleware/                # ASP.NET Core middleware
├── Persistence/               # Repository and UnitOfWork patterns
├── Security/                  # JWT and crypto helpers
├── Settings/                  # Strongly-typed settings classes

Getting Started

  1. Install NuGet Package

(Publish the package to your NuGet feed and install it in your project.)

  1. Register Services in Startup.cs or Program
// Add to your DI container
services.AddUnitOfWork(Configuration);
services.AddRootMediatr(cfg => { /* MediatR config */ });
services.AddRootsHttpClient(Configuration);
services.AddRootsMessaging(Configuration);
services.AddRootsJWT(Configuration);
  1. Configure Middleware
app.UseRootErrorHandling();
app.UseRootLogging();
app.UseRequestCulture();
  1. Configure Settings

Add relevant sections to your appsettings.json:

{
  "JwtSettings": {
   "SecretKey": "your-secret",
   "Issuer": "your-issuer",
   "Audience": "your-audience",
   "TokenExpiryInHours": 1
  },
  "RabbitMQSettings": {
   "HostName": "localhost",
   "Username": "guest",
   "Password": "guest"
  },
  "Roots": {
   "BaseUrl": "https://api.example.com"
  }
}

Key Components

Build & Test

  • Build:
    dotnet build
  • Test:
    dotnet test

Contributing

Contributions are welcome! Please open issues or submit pull requests.


License: MIT

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Languages