FastModule.Core
1.0.0
See the version list below for details.
dotnet add package FastModule.Core --version 1.0.0
NuGet\Install-Package FastModule.Core -Version 1.0.0
<PackageReference Include="FastModule.Core" Version="1.0.0" />
paket add FastModule.Core --version 1.0.0
#r "nuget: FastModule.Core, 1.0.0"
// Install FastModule.Core as a Cake Addin #addin nuget:?package=FastModule.Core&version=1.0.0 // Install FastModule.Core as a Cake Tool #tool nuget:?package=FastModule.Core&version=1.0.0
FastModule
FastModule is a lightweight, extensible, and modular package designed to simplify the development of modular applications in .NET. It provides a foundation for building applications with independent, self-contained modules, promoting reusability, scalability, and maintainability.
Getting Started
To see FastModule in action, check out the FastModule.Host.Api
project in this repository. The samples demonstrate elegant extensions around common ASP.NET Core types.
Installation
Install FastModule via NuGet:
dotnet add package FastModule.Core
Features
- Minimal API Support: Uses
IEndpointRouteBuilder
for defining routes. - Automatic Module Discovery: FastModule scans and registers implementations automatically.
- Dependency Injection: Built-in support for DI.
- Database Configuration: Easily configure database connections.
Routing
FastModule utilizes IEndpointRouteBuilder
and supports all IEndpointConventionBuilder
extensions (Minimal APIs). For example, defining a route with authorization:
Usage
app.MapGet("/", () => "Hello World!");
Creating a Module
// Program.cs
var builder = WebApplication.CreateBuilder(args);
builder.Services.AddFastModule();
var app = builder.Build();
app.MapFastModules();
app.Run();
// UserModule.cs
public class UserModule : FastModule
{
public override IEndpointRouteBuilder AddRoutes(IEndpointRouteBuilder app)
{
var users = app.MapGroup("/api").WithTags("users");
users.MapGet("/users", async (UserDbContext dbContext) =>
{
return await dbContext.Users.ToListAsync();
});
return app;
}
}
Run the application:
dotnet run
Configuration
FastModule automatically scans for implementations and registers them for DI. However, for more control, you can manually register services in the Register
method and configure database connections in AddFastModule
:
var builder = WebApplication.CreateBuilder(args);
builder.Services.AddFastModule(options =>
{
options.UseNpgsql(builder.Configuration.GetConnectionString("DefaultConnection"),
x => x.MigrationsHistoryTable("ef_migrations"));
});
Join the Community
Have questions or need help? Join our Discord channel to connect with other developers and get support!
FastModule is designed to make modular development in .NET simpler and more efficient. Contributions and feedback are welcome!
Product | Versions Compatible and additional computed target framework versions. |
---|---|
.NET | net9.0 is compatible. net9.0-android was computed. net9.0-browser was computed. net9.0-ios was computed. net9.0-maccatalyst was computed. net9.0-macos was computed. net9.0-tvos was computed. net9.0-windows was computed. |
-
net9.0
- MediatR (>= 12.4.1)
- Microsoft.EntityFrameworkCore (>= 9.0.2)
NuGet packages (3)
Showing the top 3 NuGet packages that depend on FastModule.Core:
Package | Downloads |
---|---|
FastModule.Domain
Defines the core domain layer, including common entities, value objects, and domain services. |
|
FastModule.Shared
Contains shared utilities, Events, DTOs, constants, and common services used across multiple FastModule components to promote code reusability and consistency. |
|
FastModule.User
Implements user management features, including user authentication, authorization, role-based access control (RBAC), and profile handling, leveraging Keycloak and EF Core. |
GitHub repositories
This package is not used by any popular GitHub repositories.