AdminForge 0.3.0

There is a newer version of this package available.
See the version list below for details.
dotnet add package AdminForge --version 0.3.0
                    
NuGet\Install-Package AdminForge -Version 0.3.0
                    
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="AdminForge" Version="0.3.0" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="AdminForge" Version="0.3.0" />
                    
Directory.Packages.props
<PackageReference Include="AdminForge" />
                    
Project file
For projects that support Central Package Management (CPM), copy this XML node into the solution Directory.Packages.props file to version the package.
paket add AdminForge --version 0.3.0
                    
#r "nuget: AdminForge, 0.3.0"
                    
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
#:package AdminForge@0.3.0
                    
#:package directive can be used in C# file-based apps starting in .NET 10 preview 4. Copy this into a .cs file before any lines of code to reference the package.
#addin nuget:?package=AdminForge&version=0.3.0
                    
Install as a Cake Addin
#tool nuget:?package=AdminForge&version=0.3.0
                    
Install as a Cake Tool

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 the IAdminDataProvider<T> you register; ReadOnly() drops the create and edit surface, and a column offers a sort or filter control only once Sortable() / Filterable() says the provider honours it. A host with no DbContext at all calls AddAdminForge(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 DbContext or service lives for one call, not for the hours a Blazor circuit stays open. The scope's IUserAccessor names 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. IAdminAuthorizationPolicy is 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 own IAdminAuthorizationPolicy. 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 IAsyncEnumerable streaming) — 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 @page routes are compile-time. A runtime route-rewriter is on the roadmap.
  • File uploads are in-memory in this release — a streaming IFileStorageHandler is 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 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. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.

NuGet packages

This package is not used by any NuGet packages.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last Updated
0.6.0 47 10/1/2026
0.5.0 88 9/15/2026
0.4.0 102 9/8/2026
0.3.0 109 9/6/2026
0.2.0 110 9/5/2026
0.1.0 112 8/26/2026