FoundationKit is designed as a modular suite rather than a single monolithic library. Each package has a single responsibility and explicit dependency boundaries, so you can pull in only what your project genuinely needs — a pure data-access layer for a background worker, the full controller stack for a REST API, or just the encryption and enum helpers for a utility library.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.
Package Overview
FoundationKit
Version: 4.1.0
The umbrella package that pulls in all three sibling packages as project references and adds the controller layer, encryption service, DI extension methods, and the optional AES middleware.Key types:
The umbrella package that pulls in all three sibling packages as project references and adds the controller layer, encryption service, DI extension methods, and the optional AES middleware.Key types:
ApiCoreController<TModel, TService>, ApiMapController<TService, TDto, TInput, TEdit>, MvcCoreController, IEncryptorService, EncryptorService, FoundationKitAesEncryptorMiddleware.Key extensions: AddFoundationKit(Assembly), AddFoundationKitEncryptor(EncryptorOption), AddFoundationKitIdentity<TUser, TDbContext>(), AddFoundationKitIdentityWithMapper<TUser, TDbContext>(Assembly).FoundationKit.Domain
Version: 4.1.0
Provides the base persistence primitives. Depends on
Provides the base persistence primitives. Depends on
Microsoft.EntityFrameworkCore 8.0.4 and Microsoft.AspNetCore.Identity.EntityFrameworkCore 8.0.4.Key types: BaseModel (Id, CreatedAt, UpdatedAt, IsDeleted, CreatedBy, UpdatedBy), FoundationKitDbContext, FoundationKitIdentityDbContext<TUser>, EncryptorOption, FoundationKitStaticOptions.FoundationKit.Repository
Version: 4.1.0
Generic repository abstractions and implementations. Depends on
Generic repository abstractions and implementations. Depends on
FoundationKit.Domain and AutoMapper 13.0.1.Key types: IBaseRepository<TModel>, BaseRepository<TContext, TModel>, IMapRepository<TInput, TEdit, TDto>, MapRepository<TContext, TModel, TInput, TEdit, TDto>, PaginationResult<T>, Paginate.Foundationkit.Extensions
Version: 4.1.0
Pure helpers with no direct EF Core dependency. Depends only on
Pure helpers with no direct EF Core dependency. Depends only on
FoundationKit.Domain (for shared value objects) and Microsoft.AspNetCore.Mvc.ViewFeatures 2.2.0.Key types: AesEncryptionHelper, AesConfig, CipherTweetNaCl, QueryableExtensions (PaginateAsync, Paginate), EnumExtension (GetDisplayName), ControllerExtensions (AesOk).Installation
Package Details
FoundationKit (Core)
The umbrella package is the right choice when you are building a REST API and want the full suite — base controllers, encryption, and DI conveniences — in one install. DI Registration methods| Method | Purpose |
|---|---|
AddFoundationKit(Assembly) | Registers AutoMapper profiles from your assembly |
AddFoundationKitEncryptor(EncryptorOption, ServiceLifetime) | Registers IEncryptorService with RSA/AES keys |
AddFoundationKitIdentity<TUser, TDbContext>() | Wires ASP.NET Core Identity without AutoMapper |
AddFoundationKitIdentityWithMapper<TUser, TDbContext>(Assembly) | Wires Identity and registers AutoMapper profiles |
ApiCoreController<TModel, TService> — use when your request/response type is the entity model itself:
ApiMapController<TService, TDtoModel, TInputModel, TEditModel> — use when you separate input, edit, and output DTO types via AutoMapper:
FoundationKit.Domain
Provides the data model primitives andDbContext bases that every other package builds on.
BaseModel — the abstract base all your entities must inherit:
FoundationKitDbContext — inherit to get automatic CreatedAt / UpdatedAt stamping and soft-delete query filters:
FoundationKit.Repository
Provides both a direct entity repository and a DTO-mapped repository.IBaseRepository<TModel> — full interface surface:
| Method | Signature |
|---|---|
CreateAsync | Task<TModel> CreateAsync(TModel, CancellationToken) |
UpdateAsync | Task<TModel?> UpdateAsync(TModel, CancellationToken, bool verifyEntity) |
UpdatePartialEntityAsync | Task UpdatePartialEntityAsync(TModel, List<Expression<Func<TModel, object?>>>, CancellationToken) |
GetByIdAsync | Task<TModel?> GetByIdAsync(Guid, bool asNoTracking, CancellationToken, params includes) |
GetAll | IQueryable<TModel> GetAll(expression, orderDesc, ordered, params includes) |
GetListAsync | Task<IEnumerable<TModel>> GetListAsync(orderDesc, expression, ordered, CancellationToken, params includes) |
GetPaginatedListAsync | Task<PaginationResult<TModel>> GetPaginatedListAsync(Paginate, expression, ordered, CancellationToken, params includes) |
GetOneAsync | Task<TModel?> GetOneAsync(Expression<Func<TModel, bool>>, CancellationToken) |
ExistAsync | Task<bool> ExistAsync(expression, CancellationToken) |
CountAsync | Task<int> CountAsync(CancellationToken, params expressions) |
SoftRemoveAsync | Task<bool> SoftRemoveAsync(Guid, CancellationToken) |
RemoveAsync | Task<bool> RemoveAsync(Guid, CancellationToken) |
CommitAsync | Task CommitAsync(CancellationToken) |
CommitAndResultAsync | Task<string?> CommitAndResultAsync(CancellationToken) — returns null on success, error message on failure |
Paginate — query string model consumed by GetPaginatedListAsync and ApiCoreController:
| Property | Type | Default | Description |
|---|---|---|---|
Page | int | 1 | Current page number |
Qyt | int | 10 | Items per page |
OrderByDesc | bool | true | Sort direction |
NoPaginate | bool | false | Return all records when true |
Foundationkit.Extensions
Independent helper types that can be used in any .NET 8 project regardless of whether EF Core or the controller layer is present. AES EncryptionCipherTweetNaCl)
Provides asymmetric key-pair generation, encryption, decryption, signing, and signature verification via a managed TweetNaCl implementation. Suitable for peer-to-peer message authentication.
QueryableExtensions
EnumExtension
Choosing the Right Combination
| Scenario | Packages to install |
|---|---|
| Full REST API — controllers, CRUD, pagination, encryption | FoundationKit (pulls in all others) |
| API without encryption or Identity | FoundationKit, FoundationKit.Domain, FoundationKit.Repository |
| Background worker / data-access only | FoundationKit.Domain, FoundationKit.Repository |
| API with ASP.NET Core Identity | FoundationKit + call AddFoundationKitIdentity or AddFoundationKitIdentityWithMapper |
| Utility library — enum helpers, AES, pagination only | Foundationkit.Extensions (+ FoundationKit.Domain for shared value objects) |
| DTO-mapped repository with AutoMapper | FoundationKit.Repository, FoundationKit.Domain + configure AutoMapper profiles |
The optional
FoundationKit.Events package (version 0.1.0) adds RabbitMQ-backed messaging via AddEvents, AddSubscriber, and IRabbitMessageBroker.PublishAsync. It is independent of the four core packages and is not required for basic use.