AdminForge 0.3.0
See the version list below for details.
dotnet add package AdminForge --version 0.3.0
NuGet\Install-Package AdminForge -Version 0.3.0
<PackageReference Include="AdminForge" Version="0.3.0" />
<PackageVersion Include="AdminForge" Version="0.3.0" />
<PackageReference Include="AdminForge" />
paket add AdminForge --version 0.3.0
#r "nuget: AdminForge, 0.3.0"
#:package AdminForge@0.3.0
#addin nuget:?package=AdminForge&version=0.3.0
#tool nuget:?package=AdminForge&version=0.3.0
AdminForge
AdminForge auto-generates an admin panel for ASP.NET Core apps. Point it at your DbContext, register a few dashboards or forms if you want them, mount it — done.
Quick start
builder.Services.AddAdminForge<AppDbContext>(forge => forge
.RequireAuthorizationPolicy("Admins") // or .AllowAnonymousAccess() for an open panel
/* ... */);
app.MapAdminForge(); // mounts at /admin
Install:
dotnet add package AdminForge
That's it. No JS toolchain, no separate admin host — Blazor Server components shipped inside the package render against MudBlazor.
What you get
- Auto-generated CRUD pages for every EF Core entity (list, view, create, edit, delete) — with filter, sort, pagination, and validation. Text filters match substrings, case-insensitively.
- Provider-backed tables —
AddTable<T>on any keyed class describes it from its properties and serves it through theIAdminDataProvider<T>you register;ReadOnly()drops the create and edit surface, and a column offers a sort or filter control only onceSortable()/Filterable()says the provider honours it. A host with no DbContext at all callsAddAdminForge(forge => ...)and registers a provider per table. - One DI scope per operation — every list, find, save, action and widget resolves its provider and handler in a fresh scope, so a scoped
DbContextor service lives for one call, not for the hours a Blazor circuit stays open. The scope'sIUserAccessornames the user the circuit was opened for. - Dashboards composed in C# from stat cards, line charts, and table widgets, arranged in a row-based grid layout.
- Generic forms with 8 field types (text, number, float, bool, date, datetime, markdown, file upload) and a typed submit handler.
- Per-entity custom actions surfaced as buttons on the entity view (with optional confirmation dialogs).
- Related-table links auto-generated from collection navigations; cross-entity links are configurable.
- Custom server-side columns projected via
Expression<Func<T,TValue>>— composes with filter/sort/pagination. - Audit log hook — a single delegate receives every create/update/delete/custom-action event.
- Per-action authorization policies —
AdminForge:{Entity}:{Action}policies are materialised on demand by a provider that wraps the host's own, so the host's policies keep resolving.IAdminAuthorizationPolicyis asked before every read and write the bridge performs. - Authorization required at mount —
MapAdminForge()throws at startup unless the host set an umbrella policy or registered its ownIAdminAuthorizationPolicy. An open panel has to say so:AllowAnonymousAccess(). The umbrella policy goes on the panel's endpoints, so the host's authentication scheme handles a rejected request — a cookie scheme redirects to its login page. The panel's scripts and styles are served anonymously. - Sign-out button —
WithSignOut("/admin/logout")puts a button in the app bar that posts to a host-owned endpoint; the signed-in user's name shows beside it. - Live updates for single-entity views (polling) and dashboard line charts (polling or
IAsyncEnumerablestreaming) — multiple browser tabs share one upstream stream. - Environment badge —
WithEnvironment("staging", "#ef6c00")colours the app bar and labels it, so nobody edits production thinking it is staging. - Theming hook — set a logo and primary / secondary palette colour via
WithTheme(...); defaults render MudBlazor's stock palette.
Configuration sketch
builder.Services.AddAdminForge<AppDbContext>(forge => forge
.WithTitle("My App Admin")
.WithWelcomeMessage("Pick a table from the sidebar.")
.RequireAuthorizationPolicy("Admins")
.WithSignOut("/admin/logout")
.WithAuditLog((evt, ct) => audit.RecordAsync(evt, ct))
.WithTheme(t => { t.PrimaryColor = "#00897b"; t.LogoUrl = "/logo.svg"; })
.AddTable<User>(e => e
.Nav(n => n.Group("People"))
.DisplayMember(u => u.DisplayName)
.AddAction("Reset password", async (sp, user, ctx) =>
{
if (!await ctx.ConfirmAsync($"Reset {user.Email}?")) return;
await sp.GetRequiredService<IUserService>().ResetAsync(user.Id);
ctx.ShowSuccess("Password reset email sent.");
}))
.AddTable<Order>()
// Not on the DbContext: served by services.AddAdminForgeDataProvider<AuditEntry, AuditProvider>()
.AddTable<AuditEntry>(e => e
.ReadOnly()
.AddColumn(a => a.At, c => c.Sortable())
.AddColumn(a => a.Action))
.AddDashboard("ops", d => d
.WithTitle("Operations")
.AddStatCard("Open orders", async (sp, ct) =>
await sp.GetRequiredService<AppDbContext>().Orders.CountAsync(ct))
.AddLineChart<Snapshot>("Throughput",
xAxis: p => p.At, yAxis: p => p.Count,
configure: c => c.WithStreaming(metricsStream)))
.AddForm("notify", form => form
.WithTitle("Send Notification")
.AddField(f => f.Text("Title").Required())
.AddField(f => f.Markdown("Body"))
.OnSubmit((sp, values, ctx) => SendAsync(values))));
Example
A full working sample lives in examples/TodoApp (EF Core + SQLite). Run it locally:
task example:todo:seed # one-shot DB seed
task example:todo # run the host on http://localhost:5xxx/admin
Status
Preview. APIs may shift between minor versions. The shape is settled, but expect renames and additions as the library hardens.
Releasing
Push a v* tag; CI packs and publishes it to nuget.org. Steps in docs/releasing.md.
Limitations / non-goals
- Route prefix is locked to
/admin— the Blazor@pageroutes are compile-time. A runtime route-rewriter is on the roadmap. - File uploads are in-memory in this release — a streaming
IFileStorageHandleris planned. - No multi-tenancy, no custom page builder, no multi-step forms, no i18n in v1.
- Blazor Server only for now — the architecture is renderer-agnostic (Core produces view models +
IAdminUIBridge), but only the Blazor UI is shipped today.
License
MIT.
| Product | Versions Compatible and additional computed target framework versions. |
|---|---|
| .NET | net10.0 is compatible. net10.0-android was computed. net10.0-browser was computed. net10.0-ios was computed. net10.0-maccatalyst was computed. net10.0-macos was computed. net10.0-tvos was computed. net10.0-windows was computed. |
-
net10.0
- Microsoft.AspNetCore.App.Internal.Assets (>= 10.0.0)
- Microsoft.EntityFrameworkCore (>= 10.0.8)
- MudBlazor (>= 9.5.0)
NuGet packages
This package is not used by any NuGet packages.
GitHub repositories
This package is not used by any popular GitHub repositories.