Skip to main content

Documentation Index

Fetch the complete documentation index at: https://mintlify.com/Orbis25/FoundationKit/llms.txt

Use this file to discover all available pages before exploring further.

FoundationKit is a production-ready suite of .NET 8 NuGet packages that eliminates the repetitive scaffolding every ASP.NET Core project demands. Instead of writing the same base models, generic repositories, paginated list helpers, and encryption wiring from scratch, FoundationKit ships those primitives as composable, independently installable packages — so you drop in exactly what you need and build product features from day one.

Quickstart

Install the packages, wire up your first entity, and hit a paginated API endpoint in under 10 minutes.

Packages

Explore the four NuGet packages and choose the right combination for your project.

Why FoundationKit?

Every ASP.NET Core project tends to start the same way: a BaseEntity with an Id and timestamps, a generic repository wrapping EF Core, a PaginationResult<T> type, and a handful of extension methods. FoundationKit codifies these patterns once — with full async/CancellationToken support, soft-delete, partial updates, and AutoMapper integration — so your team never debates the “right” way to wire them up again.

Four-Package Architecture

FoundationKit is intentionally split into four separate NuGet packages, each with a narrow responsibility. You can install the whole suite or pick only what your project needs.

FoundationKit

The umbrella package. Provides ApiCoreController, ApiMapController, the EncryptorService (RSA + AES), DI extension methods (AddFoundationKit, AddFoundationKitEncryptor, AddFoundationKitIdentity), and the AES middleware. Depends on the three packages below.

FoundationKit.Domain

Published as FoundationKit.Domain on NuGet. Provides BaseModel, FoundationKitDbContext, FoundationKitIdentityDbContext, and EF Core configuration helpers backed by Microsoft.EntityFrameworkCore 8.0.4.

FoundationKit.Repository

Provides IBaseRepository<TModel>, BaseRepository<TContext, TModel>, IMapRepository, MapRepository, and the PaginationResult<T> / Paginate value objects. Depends only on FoundationKit.Domain and AutoMapper 13.0.1.

Foundationkit.Extensions

Standalone helpers: AES encryption (AesEncryptionHelper, AesConfig), TweetNaCl asymmetric cipher (CipherTweetNaCl), QueryableExtensions.PaginateAsync, EnumExtension.GetDisplayName, and controller response helpers. No dependency on EF Core.

Key Features

Generic Repository Pattern

BaseRepository<TContext, TModel> implements CreateAsync, UpdateAsync, UpdatePartialEntityAsync, GetByIdAsync, GetPaginatedListAsync, SoftRemoveAsync, RemoveAsync, ExistAsync, CountAsync, and CommitAsync with full transaction support out of the box.

Paginated API Controllers

ApiCoreController and ApiMapController expose standard CRUD endpoints — including a GET /api/[controller]?page=1&qyt=10 paginated list — with zero boilerplate. Override any action to customise behaviour.

Soft Delete Built In

BaseModel carries an IsDeleted flag. Calling SoftRemoveAsync sets the flag and saves — no data is ever destroyed unless you call RemoveAsync explicitly.

Encryption Services

AddFoundationKitEncryptor registers IEncryptorService with configurable RSA public/private keys and an AES header. The optional FoundationKitAesEncryptorMiddleware transparently encrypts HTTP responses.

ASP.NET Core Identity Integration

AddFoundationKitIdentityWithMapper and AddFoundationKitIdentity wire up IdentityUser, roles, SignInManager, and EntityFrameworkStores in one call, alongside AutoMapper if required.

AutoMapper First-Class

AddFoundationKit(Assembly.GetExecutingAssembly()) registers AutoMapper profiles from your assembly automatically. MapRepository provides DTO-centric CRUD that maps between input, edit, and output types.

RabbitMQ Event Bus

An optional FoundationKit.Events package (not required for basic use) adds AddEvents, AddSubscriber, and IRabbitMessageBroker.PublishAsync for lightweight distributed messaging.

.NET 8 & NuGet Distribution

All packages target net8.0 exclusively and are published to NuGet.org. The four core packages are at version 4.1.0; FoundationKit.Events is at 0.1.0. CI publishing is handled by the Release to NuGet GitHub Actions workflow.

Target Framework & Distribution

All four packages target net8.0 and are distributed via NuGet.org. The four core packages are at stable release 4.1.0; FoundationKit.Events is at 0.1.0. Source code is available at github.com/Orbis25/FoundationKit under the MIT licence.
FoundationKit does not ship runtime migrations. You are responsible for running dotnet ef migrations add and dotnet ef database update against your own DbContext that inherits FoundationKitDbContext.

Build docs developers (and LLMs) love