Skip to content

C#

Mateu has a C# server-side implementation (Mateu.NET). You annotate plain C# classes, and the existing renderers (web and native) render them with zero client changes — exactly as they render the Java backend.

🎬 One wire, three languages — on YouTube
🎬 Mateu deep dives: Mateu for .NET developers — on YouTube

Coming from Java? The Language Rosetta maps every declaration idiom side by side, and the parity matrix shows exactly what this server supports today.

Every Mateu renderer speaks one protocol: POST /{baseUrl}/mateu/v3/sync/{route} in, a UIIncrement JSON tree out. So the C# side does not re-implement the whole framework — it emits the same JSON. An ASP.NET Core minimal API hosts the sync endpoint; a reflection mapper turns your annotated classes into the Mateu component tree; System.Text.Json polymorphism produces the type discriminators the renderers expect.

The implementation lives at backend/dotnet (DESIGN.md for the plan, README.md for status).

Mateu.NET ships as four NuGet packages, versioned in lockstep with the Java artifacts (the release v3.0.0 is 3.0.0 on NuGet; a pre-release such as v3.1-rc.1 is 3.1.0-rc.1, installed with --prerelease). They target net10.0, the current LTS. An ASP.NET Core app needs only the adapter — it brings the other three:

Terminal window
dotnet add package Mateu.AspNetCore
PackageWhen you reference it directly
Mateu.AspNetCoreThe web app: AddMateu() / MapMateu()
Mateu.UidlA class library holding only your views (the attributes and fluent components) — pass its assembly to AddMateu (see below)
Mateu.CoreNever directly — the engine is internal; Mateu.AspNetCore brings it (it exports only a few knobs: DevSpecs, PartialRegistry, DocumentStore, InferenceSwitches)
Mateu.DtosReading or producing the wire model

An app shell with a menu, a form and a CRUD, from an empty folder (the IDE wizards — IntelliJ File › New › Project… › Mateu, VS Code Mateu: New Project…, runtime .NET — generate the same kind of project):

Terminal window
dotnet new web -n MyApp && cd MyApp
dotnet add package Mateu.AspNetCore

Program.cs — AddMateu() finds every [UI]/[App] class of the app:

using Mateu.AspNetCore;
var builder = WebApplication.CreateBuilder(args);
builder.Services.AddMateu();
var app = builder.Build();
app.MapMateu();
app.Run("http://0.0.0.0:8593");

Products.cs — the entity, where its rows live, the CRUD over it and the app shell whose menu leads to it:

using Mateu.Uidl;
using System.Collections.Concurrent;
using System.ComponentModel.DataAnnotations;
public class Product
{
// a product code the user types on create — without [EditableOnlyWhenCreating] the id is
// technical: the new form has no input for it and Save must assign it (see "CRUD" below)
[Required, EditableOnlyWhenCreating] public string Id { get; set; } = "";
[Required] public string Name { get; set; } = "";
[Range(0, double.MaxValue), Money] public double Price { get; set; }
public ProductStatus Status { get; set; }
}
public enum ProductStatus { Available, OutOfStock, Discontinued }
// One shared store: the view models are created fresh on every request.
public static class Store
{
static readonly ConcurrentDictionary<string, Product> db = new();
public static IEnumerable<Product> Search(string? s) =>
db.Values.Where(p => string.IsNullOrEmpty(s) || p.Name.Contains(s, StringComparison.OrdinalIgnoreCase))
.OrderBy(p => p.Id);
public static Product? Get(string id) => db.GetValueOrDefault(id);
public static void Save(Product p) => db[p.Id] = p;
public static void Delete(string id) => db.TryRemove(id, out _);
}
[UI("products"), Title("Products")]
public class Products : Crud<Product>
{
public override IEnumerable<Product> Fetch(string? search) => Store.Search(search);
public override Product? Get(string id) => Store.Get(id);
public override void Save(Product p) => Store.Save(p);
public override void Delete(string id) => Store.Delete(id);
}
[App("My app")]
public class Shell
{
[MenuItem("Products")] public Products Products() => new();
}

The server answers the Mateu API; to open it in a browser it also needs the web renderer, which is a jar on Maven Central (the NuGet packages do not include it). Download the one of your version and point MATEU_UI at it:

Terminal window
V=3.0.5
curl -LO https://repo1.maven.org/maven2/io/mateu/mateu-vaadin/$V/mateu-vaadin-$V.jar
MATEU_UI=mateu-vaadin-$V.jar dotnet run # http://localhost:8593: the shell, opening on Products

New creates, a row opens the record, Edit edits; [Required] is checked in the browser and on the server. Add a screen by writing its [UI] class (see Forms) and a [MenuItem] method returning it. To deploy, publish as any ASP.NET Core app and keep MATEU_UI (or app.MapMateu(ui: "…")) pointing at the jar — or at its extracted static/ folder:

Terminal window
dotnet publish -c Release -o out
MATEU_UI=/srv/mateu-vaadin-$V.jar dotnet out/MyApp.dll

In the Development environment the page shows a small 🐛 button (bottom right): Mateu’s debug panel with the app state and data. It is not there in Production.

Terminal window
# needs the .NET 10 SDK
cd backend/dotnet
dotnet run --project samples/Mateu.Demo # serves on http://0.0.0.0:8593
dotnet test # golden-JSON tests

Open it in a browser: the server serves the web renderer’s page too when you tell it where the renderer is — app.MapMateu(ui: "<path>") or the MATEU_UI environment variable, pointing at the io.mateu:mateu-vaadin (or mateu-redwood) jar of the version you target, or at its extracted static/ folder. The jar is on Maven Central; the NuGet packages do not include it:

Terminal window
V=3.0.5
curl -LO https://repo1.maven.org/maven2/io/mateu/mateu-vaadin/$V/mateu-vaadin-$V.jar
MATEU_UI=mateu-vaadin-$V.jar dotnet run --project samples/Mateu.Demo # http://localhost:8593

The page answers the mount and every deep link under it, the renderer’s assets are served at the origin root, your own endpoints keep winning, and nothing under /mateu is ever answered with the page — the same rules as a Java app. Without ui/MATEU_UI the server answers the sync API only (a browser opening the mount gets a short hint page, status 404, that says so), for a renderer served elsewhere: the React Native app (cd frontend/app/react-native && EXPO_PUBLIC_MATEU_BACKEND_PORT=8593 npx expo start --web — or EXPO_PUBLIC_MATEU_BACKEND_URL=http://localhost:8593; the server must list that origin in its CORS settings), the IntelliJ plugin, or the Vaadin renderer’s dev server (MATEU_BACKEND=http://localhost:8593 npm run dev in frontend/web/monorepo/apps/vaadin: its proxy forwards /mateu to the backend). The server binds to 0.0.0.0, so the iOS simulator (localhost:8593) and Android emulator (10.0.2.2:8593) reach it too.

ProjectRole
src/Mateu.UidlPublic API — attributes ([UI], [Title], [Button], …) + data types (Message)
src/Mateu.DtosThe wire model — UIIncrementDto, ComponentDto + metadata (polymorphism on type)
src/Mateu.CoreThe engine (internal) — route resolution, the reflection mapper, action dispatch
src/Mateu.AspNetCoreAddMateu() / MapMateu() — DI + the POST /mateu/v3/sync/{route} endpoint
samples/Mateu.DemoA runnable ASP.NET app
test/Mateu.TestsGolden-JSON tests asserting wire compatibility with the Java backend

Wire it up in Program.cs:

using Mateu.AspNetCore; // AddMateu / MapMateu
var builder = WebApplication.CreateBuilder(args);
builder.Services.AddMateu();
var app = builder.Build();
app.MapMateu();
app.Run("http://0.0.0.0:8593");

Parameterless, AddMateu() scans only the entry assembly (the web app). When your views live in a separate class library, name the assemblies to scan — otherwise their routes are silently not found:

builder.Services.AddMateu(typeof(Program).Assembly, typeof(Person).Assembly);

AddMateu(o => …) configures the server (MateuOptions); MapMateu(baseUrl: "", ui: null) maps the endpoints. Most options fall back to an environment variable, so a deployment can switch them without code.

builder.Services.AddMateu(o =>
{
o.Environment = "staging";
o.OracleCdnUrl = "https://cdn.example.com/oracle/cdn";
});
OptionDefaultWhat it does
Identitythe authenticated HttpContext.User’s claimsHttpContext → Identity? that [EyesOnly]/[ReadOnlyUnless]/[DisabledUnless] match (see Identity, permissions and secrets).
Secretsan ISecretsProvider service, else env MATEU_SECRET_<KEY>${secret.KEY} in proxied REST sources.
DetailedErrorsonly in DevelopmentException messages on screen.
Devenv MATEU_DEVDevelopment mode: specs watched, GET /mateu/dev/events + POST /mateu/dev/reload.
BuildIdenv MATEU_BUILD_ID, else a fingerprint of the releaseThe X-Mateu-Build id (versions across teams).
OracleCdnUrlenv MATEU_ORACLE_CDN_URLA mirror of Oracle’s CDN for the Redwood page (Oracle CDN mirror).
Pwaon, unless env MATEU_PWA_ENABLED=false (always off in development)Serve every UI as an installable PWA.
Environmentenv MATEU_ENVIRONMENTThe type: Environment overlay on the source catalogue (environments).
MockSourcesenv MATEU_SOURCES_MOCKSample mode: sources with sample: answer it instead of being called. Never in production.
HttpClienta shared client, 60 s timeoutThe client proxied REST fetches use.
Mcpenv MATEU_MCP_ENABLED, else offThe native MCP endpoint POST /mateu/mcp.
McpPushenv MATEU_MCP_PUSH_ENABLED, else offLive UI push (needs Mcp).
McpPushRatePerMinuteenv MATEU_MCP_PUSH_RATE_PER_MINUTE, else 30Messages per session per rolling minute.
McpPushMaxSessionsenv MATEU_MCP_PUSH_MAX_SESSIONS, else 1000Live UI sessions held at once.
McpPushMaxSessionsPerOwnerenv MATEU_MCP_PUSH_MAX_SESSIONS_PER_OWNER, else 20Sessions per signed-in user.
McpPushMaxAnonymousSessionsPerAddressenv MATEU_MCP_PUSH_MAX_ANONYMOUS_SESSIONS_PER_ADDRESS, else 200Anonymous sessions per client address (behind a proxy, use ASP.NET’s ForwardedHeaders).
RemotesnoneRemoteDescriptors for server-resolved micro frontends and content slots (on top of IRemoteCatalogSupplier services).
DefaultTimeoutMs500Budget of a server-resolved fragment that names none.
MaxBudgetMs2000The most a response waits for its fragments.
ContentRemoteIdcontentThe remote content slots are resolved against.
ContentRoute/content-slots/{key}A slot’s route on the content remote.
SelfBaseUrlthe local socketThis server’s origin, for a remote registered as a path on it.
ContentSlotsDescriptorEnabledoffServe the __content_slots__ descriptor action.

The micro-frontend collaborators are DI services: register your own IRemoteRegistry, IRemoteIdentityStrategy, ICorrelationIdProvider, IFragmentCacheStore or IMicroFrontendResolutionListener to replace or extend Mateu’s.

A [UI] class becomes a routed form. Public properties become fields (the type is inferred: string → string, int/long → integer, double/decimal → number, bool → bool, DateOnly → date, DateTime/DateTimeOffset → dateTime, TimeOnly → time, enum → dropdown). [Required] (from System.ComponentModel.DataAnnotations) makes a field required and is enforced server-side. A method with [Button] returning a Message shows a toast.

using Mateu.Uidl;
using System.ComponentModel.DataAnnotations;
[UI("person"), Title("Person"), Subtitle("Personal data")]
public class Person
{
[Required, Section("Identity")] public string? Name { get; set; }
public int Age { get; set; }
[Section("Preferences")] public bool Subscribed { get; set; }
public Role Role { get; set; } // enum → dropdown
[Button] public Message Save() => new($"Saved {Name}");
}
public enum Role { Guest, Admin }

[Section("…")] groups the fields that follow it into a titled card.

A form lays out in one column with up to 6 visible fields and two from 7 on (counted over the whole form, like the Java and Python servers — see how many columns). [FormLayout(Columns = N)] on the class fixes it (Columns = 2 keeps two columns on a small form); a [Zone]d form keeps two.

Derive from Crud<T> and override Fetch (and, as needed, Get/Save/Delete). You get a searchable listing — a table on desktop, cards on mobile — plus full detail / edit / new flows (routes /x, /x/{id}, /x/{id}/edit, /x/new), with [Required] validation on save and back-to-list navigation.

[UI("reservations"), Title("Reservations")]
public class Reservations : Crud<Reservation>
{
public override IEnumerable<Reservation> Fetch(string? search) =>
Store.All.Where(r => search is null || r.Locator.Contains(search));
public override Reservation? Get(string id) => Store.ById(id);
public override void Save(Reservation r)
{
if (string.IsNullOrEmpty(r.Id)) r.Id = Guid.NewGuid().ToString("N")[..8]; // a NEW record: the store assigns its id
Store.Put(r);
}
public override void Delete(string id) => Store.Remove(id);
}

Fetch is the only abstract member, but a crud that writes must also override Save and Delete: their defaults refuse with a “Not implemented” error naming the override, so a crud that forgot them can never answer “Saved” and drop the change. A crud that should not write narrows CanCreate/CanEdit/CanDelete instead, which also hides the buttons.

The record id is the entity’s Id property; when the key is called something else, mark it [Id] ([Id] public string Code { get; set; }). An entity with neither is refused when the crud renders, with that fix in the message.

Who chooses the id. A plain Id is a technical id: the creation form has no input for it and a create never takes one from the client — the store assigns it in Save, as above. A create the store saves with the id still blank (or an empty Guid) is refused with “The record was saved without an id…” instead of answering “Saved” (every new record would otherwise land on the same empty key). When the user should type the id (a product code, a locator), mark it [Required, EditableOnlyWhenCreating]: it is an input on the new form and read-only afterwards, and a create whose id already exists is refused (“A record with this id already exists…”). [GeneratedValue] marks an id the server fills into the creation form.

The listing renders a smart search bar whose filters come straight from the entity: enums become multi-selects (IN over the picked values), DateOnly/DateTime properties become from–to date ranges, numerics annotated [RangeFilter] become min–max ranges, and strings/bools/plain numbers keep single-value widgets. The values are applied automatically over what Fetch returns — no filter code to write:

public class Reservation
{
public string Id { get; set; } = "";
public string Guest { get; set; } = "";
public Channel Channel { get; set; } // multi-select filter
public DateOnly Arrival { get; set; } // date-range filter
[RangeFilter] public double Total { get; set; } // number-range filter
}

Override EditInDrawer => true and New/row clicks open the create/edit form in a drawer sliding over the listing (the listing never unmounts; saving persists, closes the drawer and refreshes the rows in place). EditDrawerWidth adjusts the panel width.

A record’s page (/x/{id}) is its read-only form. For other content, the entity implements IDetailContentSupplier and returns the component to show instead — for instance an ItemOverview built from the record. The page title and toolbar (Back to list, Edit) stay the crud’s, the edit and create forms keep their forms, and returning null keeps the default form for that record:

public class Student : IDetailContentSupplier
{
public string Id { get; set; } = "";
public string Email { get; set; } = "";
public IComponent? DetailContent() => new StudentOverview(this).Component();
}
public class StudentOverview(Student student) : ItemOverview
{
public Text KeyInfo { get; } = new("Email: " + student.Email);
[Panel(Title = "History")]
public Text History { get; } = new("Enrolled since 2024");
}

Two more archetypes mirror the Java orchestrators: CollectionDetail<TRow> (searchable card list on the left, the selected item’s detail re-rendered in place on the right) and GeneralOverview<TRow> (a record context switcher over the selected record’s overview). Both are built on the fluent FormField primitive — a live field you can compose into any fluent tree.

Customise each screen: creation form, detail, editor

Section titled “Customise each screen: creation form, detail, editor”

A crud is four screens — the listing (/customers), the creation form (/customers/new), the record’s read-only detail (/customers/C-001) and the editor (/customers/C-001/edit) — and by default they all show the entity’s properties. Java has three levels to make them differ; this port has two of them:

You want…LevelHow in C#
A property not shown on one screen1[HiddenInCreate], [HiddenInView], [HiddenInEditor], [HiddenInList]
A code the user types once, then never changes1[EditableOnlyWhenCreating]
A property shown but never typed (set by the store)1[ReadOnly] (+ [HiddenInCreate] when New should not show it)
A property only some users may change, or see1[ReadOnlyUnless(Roles = …)], [EyesOnly(Roles = …)]
No New, no Edit1override CanCreate / CanEdit (no [NotCreatable] attributes here)
New starts filled in2property initializers of the entity — see below
A value computed when a record is opened2override Get(id) — it serves the detail and the editor
Different classes per screen3IListing<TRow> + INavigable / IEditable / ICreatable / IDeletable

Level 1 — same properties, different per screen:

public class Customer
{
[Required, EditableOnlyWhenCreating] public string Id { get; set; } = ""; // typed on New, read-only afterwards
[Required] public string Name { get; set; } = "";
public string? Email { get; set; }
[HiddenInCreate, ReadOnly] public DateOnly? CustomerSince { get; set; } // set by the store, never typed
[HiddenInList, HiddenInView] public string? InternalNotes { get; set; } // only on the two forms
[ReadOnlyUnless(Roles = ["manager"])] public double CreditLimit { get; set; } = 1000; // only a manager changes it
[HiddenInCreate, HiddenInEditor, HiddenInList] public int OpenOrders { get; set; } // only on the detail
}
public static class CustomerStore // your data; a static list keeps the example short
{
public static readonly List<Customer> All = [];
public static int OpenOrdersOf(string customerId) => 0; // e.g. a query to the orders service
}
[UI("customers"), Title("Customers")]
public class Customers : Crud<Customer>
{
public override IEnumerable<Customer> Fetch(string? search) => CustomerStore.All;
public override Customer? Get(string id) => CustomerStore.All.FirstOrDefault(c => c.Id == id);
public override void Save(Customer customer)
{
customer.CustomerSince ??= DateOnly.FromDateTime(DateTime.Today); // New does not show it
CustomerStore.All.RemoveAll(c => c.Id == customer.Id);
CustomerStore.All.Add(customer);
}
public override void Delete(string id) => CustomerStore.All.RemoveAll(c => c.Id == id);
}

New shows Id, Name, Email, InternalNotes and CreditLimit (read-only but for a manager); the detail Id, Name, Email, CustomerSince, CreditLimit and OpenOrders; the editor the same as New plus CustomerSince, with Id and CustomerSince read-only. What a form does not let the user write is never taken from the browser on save.

Level 2 — same class, other content. The crud builds New from new T(), and the detail and the editor from Get(id). So the creation form’s defaults are the entity’s property initializers (CreditLimit = 1000 above), and a value computed when a record is opened goes in Get:

[UI("customers"), Title("Customers")]
public class Customers : Crud<Customer>
{
// …Fetch, Save and Delete as above
public override Customer? Get(string id)
{
var customer = CustomerStore.All.FirstOrDefault(c => c.Id == id);
if (customer is not null) customer.OpenOrders = CustomerStore.OpenOrdersOf(id);
return customer;
}
}

Level 3 — a class per screen. Implement the capabilities one by one and give each screen its own type. Here a detail and a creation form of their own — the next code already filled in — and no editor at all (no Edit button, no /edit route):

public class CustomerCard
{
public string Name { get; set; } = "";
public string? Email { get; set; }
public string Activity { get; set; } = "";
}
public class NewCustomer
{
[Required, EditableOnlyWhenCreating] public string Id { get; set; } = "";
[Required] public string Name { get; set; } = "";
}
[UI("directory"), Title("Customers")]
public class CustomerDirectory : IListing<Customer>, INavigable<CustomerCard, string>, ICreatable<NewCustomer, string>
{
public ListingData<Customer> Search(SearchRequest request) => ListingData<Customer>.From(CustomerStore.All);
public CustomerCard View(string id)
{
var c = CustomerStore.All.First(c => c.Id == id);
return new() { Name = c.Name, Email = c.Email, Activity = $"customer since {c.CustomerSince}" };
}
public NewCustomer CreationForm() => new() { Id = $"C-{CustomerStore.All.Count + 1:000}" }; // the next free code
public string Create(NewCustomer form)
{
CustomerStore.All.Add(new() { Id = form.Id, Name = form.Name, CustomerSince = DateOnly.FromDateTime(DateTime.Today) });
return form.Id;
}
}

Add IEditable<TEditor, string> (Edit(id) + Save(editor)) for an editor class of its own and IDeletable<string> for Delete. The Java guide walks the same example through the three levels: Customise each screen.

When you don’t want the whole CRUD pack, implement IListing<TRow> — one method — and grow the page by declaring capabilities, exactly like the Java model:

[UI("/orders")]
public class Orders : IListing<OrderRow>, ISearchable, IFilterable<OrderFilters>
{
public ListingData<OrderRow> Search(SearchRequest request)
{
var text = request.SearchText; // filled because ISearchable
var filters = request.Filters<OrderFilters>(); // typed, from IFilterable
return ListingData.From(repo.Find(text, filters, request.Pageable));
}
}

A bare IListing<TRow> is just the table (sorting + pagination free). Then:

DeclareContractYou get
ISearchable— (marker)the search box
IFilterable<TFilters>— (marker)the filter bar, built reflectively from TFilters
INavigable<TDetail, TId>View(id)clickable rows + the /:id detail page
IEditable<TEditor, TId>Edit(id) + Save(editor)editing — in a drawer over the listing when not navigable
ICreatable<TForm, TId>CreationForm() + Create(form)the New button + /new form
IDeletable<TId>DeleteAllById(ids)row selection + the Delete button

Capability methods take typed objects (the framework binds the submitted state for you — Save(editor), Create(form)), the C# idiom of the port. ListingData.From(rows) sorts and pages in memory; construct it with an explicit TotalElements to push paging to the database. Crud<T> is the full pack — all capabilities at once. Narrow it by overriding the virtual CanView/CanEdit/CanCreate/CanDelete hooks, and switch the built-in New / Delete / “Save and next” / error-banner affordances on, off or disabled with Display (there are no subtractive attributes like Java’s @NotCreatable in this port):

public override bool CanDelete => false; // no Delete, no selection
public override CrudDisplay Display => CrudDisplay.Defaults with { Create = Toggle.Off }; // no New

An [App] class is the application shell; each [MenuItem] method contributes a menu entry that navigates to the view it returns.

[App("My C# Mateu app")]
public class DemoApp
{
[MenuItem("Reservations")] public Reservations Reservations() => new();
[MenuItem("Person")] public Person Person() => new();
[MenuItem("Sign up")] public SignupWizard SignupWizard() => new();
}

Derive from Wizard, tag each field with [Step(n)], and implement Complete(). Mateu renders a progress bar plus Back/Next; the step + field values round-trip through component state. Annotate the class with [WizardProgress("steps")] for connected step bullets, or [WizardProgress("rail")] for the guided-process lateral rail (a sticky right band with a big current | total counter over the vertical step list).

[UI("signup"), Title("Sign up")]
public class SignupWizard : Wizard
{
[Step(1)] public string? Email { get; set; }
[Step(2), Password] public string? Password { get; set; }
public override Message Complete() => new($"Welcome {Email}");
}
  • [Subtitle("…")] — a subtitle under the page title.
  • [Banner(BannerTheme.Info, "Title")] on a method — a banner below the header. Themes: Info, Success, Warning, Danger. If the method returns a string, that’s the banner description.
  • [HeaderBadge(color: "success")] on a property — a status chip in the header strip (shown when the value is non-empty).
[Banner(BannerTheme.Info, "Heads up")] public string Note() => "Fields marked * are required";
[HeaderBadge("success")] public string Status { get; set; } = "Active";

Tag consecutive fields with [Tab("Name")] to group them into a tab strip (a TabLayout); the first tab is active by default.

[Tab("Identity")] public string? Name { get; set; }
[Tab("Identity"), Password] public string? Secret { get; set; }
[Tab("Profile")] public string? Bio { get; set; }
AttributeEffect
[Multiline]renders as a multi-line text area
[Password]renders as a password input
[Money]tags the field money so the renderer formats it as currency
[PlainText]renders read-only plain text (also valid at class level for all fields)
[Stereotype("…")]sets an explicit stereotype
[Text(Size = "xl", Container = "p")]shows the value as a text block (${state.field}) instead of an input
[Colspan(n)]the field spans n columns of its form row
[Multiline] public string? Notes { get; set; }
[Money] public decimal Balance { get; set; }
[PlainText] public string? MemberSince { get; set; }
[Text(Size = "xl")] public string? Greeting { get; set; } = "Welcome back";

Intrinsically wide widgets — grids, text areas, rich text, HTML and Markdown — span the whole row of a multi-column section on their own; an explicit [Colspan] still wins. In a one-column form they stay one column wide.

A list property of rows (List<Guest>) renders as a grid. Unless the form is read-only, the grid is editable the same way as on the Java server: + opens an empty row editor beside the grid, each row has an Edit button (with Prev/Next between rows), and the toolbar removes or moves the selected rows. Every change is applied to the form’s state on the server — the list is saved with the form, by your own [Button]. The row editor validates only the row’s own constraints ([Required], [Range]…).

With [InlineEditing] on the property the cells edit in place instead, and + appends an empty row to edit in place. This works on plain views, on the entity form of a Crud<T> and on the current step of a wizard.

public class Guest { [Required] public string? Name { get; set; } public int Age { get; set; } }
[UI("check-in"), Title("Check-in")]
public class CheckIn
{
public List<Guest> Guests { get; set; } = [];
[InlineEditing] public List<Guest> Companions { get; set; } = [];
[Button] public Message Save() => new($"{Guests.Count} guests");
}
  • [Kpi("Title")] on a (parameterless) method → a KPI card in the page header showing the method’s return value.
  • [Fab("icon", "label", order)] on a method → a floating action button; clicking it invokes the method like any other action.
[Kpi("Open tickets")] public string OpenTickets() => "42";
[Fab("plus", "Add", 0)] public Message Add() => new("Added");

Bind an action method to a shortcut with [Shortcut("ctrl+s")].

[Button, Shortcut("ctrl+s")] public Message Save() => new("Saved");
  • [Compact] — high-density rendering (condensed spacing) for information-dense screens.
  • [ConfirmOnNavigationIfDirty] — warn before leaving the view with unsaved changes.
[UI("checkin"), Compact, ConfirmOnNavigationIfDirty]
public class CheckIn { /* … */ }

The nine dashboard/UX component types are available as fluent records (in Mateu.Uidl): MetricCard (with MetricTrend up/down/neutral), Scoreboard, DashboardPanel, ResponsiveGrid (DashboardLayout for a uniform column count), FoldoutLayout/FoldoutPanel, HeroSection, EmptyState, Skeleton (text/card/grid/form variants) and Gantt/GanttTask — plus the generic Text, Button, Card, HorizontalLayout, VerticalLayout and TabLayout/TabPanel building blocks. They serialize to the exact wire shape of the Java DTOs, so the renderers draw the C# output unchanged.

Any view can return a fluent tree by implementing IComponentTreeSupplier, but the easiest path is a declarative page archetype — derive from Dashboard, Foldout, Welcome or ItemOverview and declare component-holding properties; [Panel] marks titled tiles / fold-out panels / tabs:

[UI("dashboard"), Title("Sales dashboard")]
public class SalesDashboard : Dashboard // or Foldout, Welcome, ItemOverview
{
// Consecutive MetricCard properties form a Scoreboard KPI band.
public MetricCard Revenue { get; } = new()
{ Title = "Revenue", Value = "1.2", Unit = "M€", Trend = MetricTrend.Up,
TrendLabel = "+12%", ActionId = "openRevenue" };
// [Panel] component properties become titled tiles on a responsive grid.
[Panel(Title = "Delivery plan", ColSpan = 2)]
public Gantt Plan { get; } = new() { Tasks = [ new GanttTask
{ Id = "t1", Title = "Build", Start = new(2026, 7, 1), End = new(2026, 8, 20), Progress = 40 } ] };
[Panel(Title = "Alerts")]
public EmptyState Alerts { get; } = new() { Icon = "🎉", Title = "No alerts" };
public Message OpenRevenue() => new("Drill-in"); // MetricCard.ActionId dispatches this
}
  • Dashboard — MetricCards → Scoreboard band; [Panel] components → DashboardPanel tiles on a ResponsiveGrid (override Columns to fix the count; 0 = auto-fit).
  • Foldout — the first non-[Panel] component property is the always-visible overview; [Panel(Icon = …, Open = false)] properties are lateral fold-out panels.
  • Welcome — Button properties become CTAs inside a centered HeroSection (override HeroTitle/HeroSubtitle/HeroImage); [Panel] properties are highlight tiles below.
  • ItemOverview — the first non-[Panel] component property is the sticky key-info card (left); [Panel(Title = …)] properties become tabs on the right.
  • i18n — implement ITranslator and register it; titles, labels and menu entries are translated.
  • Events — [Emits("event-name")] advertises an event a view emits; [SubscribeTo("event", "action")] runs action when that event fires (an OnCustomEvent trigger).
  • Security — [EyesOnly(Permissions = new[] { "x" })] on a view class restricts it (403, and its menu entries hidden). Logging in is your ASP.NET Core authentication’s job — [App] carries no login/logout URLs. Field and action access is covered in Identity, permissions and secrets below.
public class UpperTranslator : ITranslator
{
public string Translate(string key) => key.ToUpperInvariant();
}
[UI("orders"), Emits("order-created"), SubscribeTo("inventory-changed", "refresh")]
public class Orders { /* … */ }

[EyesOnly] (hide), [ReadOnlyUnless] (lock) and [DisabledUnless] (disable, and refuse the action with HTTP 403 when invoked anyway) match the caller’s Identity — roles, groups, scopes, permissions: AND across the declared dimensions, OR within each, and no identity means unauthorized. AddMateu takes the identity from HttpContext.User, so whatever authentication the host configures (JWT bearer, cookies, Windows) applies as is:

DimensionClaims read
rolesthe identity’s role claim type (what IsInRole reads), role, roles
groupsgroups, group
scopesscope, scp (space-separated)
permissionspermissions, permission

The gates hold on every path a request can take, not only on what is drawn:

  • an [EyesOnly] property of a listing row is neither a column nor a value in the rows (nor a sort, filter or totals key) for a caller who may not see it; inside a nested form, a grid field’s rows, a wizard’s state and a nested object in a listing cell the attributes hold at every level, and a [GroupBy] column the caller may not read gives no groups;
  • a settable class-typed property of a view is a nested form: it is drawn, its values travel in the state and the client edits them (bound into the view’s own copy, never into a shared default object). An object the view only holds — a service, an HTTP client, its configuration — is a get-only property (public Svc Svc { get; } = …), a field or a non-public member: never sent, never written;
  • a proxied [RestAction]/[RestOptions] is refused (403) by __restfetch__ when its method’s [EyesOnly]/[DisabledUnless] (or its property’s [EyesOnly]) refuses the caller — the server never makes, with your secrets, a call the caller could not trigger;
  • a save binds only what its form let the user write: a [ReadOnly], hidden or create-only property keeps the stored value on a crud save, an inline row edit, an editable view’s save and a capability listing’s save/create; a crud create whose id names a stored record is an edit and needs CanEdit;
  • a view model a routes.yaml entry binds keeps its entries’ keys when a request names it under another route: allowed only when one of its own routes is reachable for the caller, and then with the union of their locked fields, refused actions and hidden fields; a field its layout hides (eyesOnly:) is not in the view model’s state either;
  • a listing query is bounded: a page below 0 is the first, a page size is at most MATEU_LISTING_MAX_PAGE_SIZE (500), and a sort or filter on a field the caller cannot read is dropped;
  • _presence answers nothing about a record whose route or view the caller may not open;
  • an Idempotency-Key has a per-caller share (MATEU_IDEMPOTENCY_MAX_ENTRIES_PER_CALLER, 100) of both tables, a key resent with another request is refused, and a keyed run goes on (keeping its key) when the client leaves;
  • an upload ticket sends 10 files for a single-file field, MATEU_UPLOADS_MAX_FILES_PER_TICKET (100) for a multiple one; past it both upload endpoints answer 429.

A claim holding a JSON array is split. When your claims are shaped differently, map them yourself:

builder.Services.AddAuthentication().AddJwtBearer();
builder.Services.AddMateu(o =>
{
o.Identity = ctx => ctx.User.Identity?.IsAuthenticated == true
? new Identity(Roles: ctx.User.FindAll("app_roles").Select(c => c.Value).ToList())
: null;
// ${secret.KEY} in a PROXIED REST source (the only channel that injects secrets, so the key
// never reaches the browser). Without it: an ISecretsProvider service, else the env var
// MATEU_SECRET_<KEY> (only that prefix, never an arbitrary variable).
o.Secrets = key => builder.Configuration[$"Mateu:Secrets:{key}"];
}, typeof(Program).Assembly);

[Audience("staff")] is not one of these gates. The audience is the value of the [AppContext] selector named audience — app state the client sends — so it only projects what is rendered (fields, buttons, menu entries for that persona). It never refuses an invocation: anything a client could get by clearing a selector is not protected. Put [EyesOnly]/[DisabledUnless] on whatever must really be restricted.

An exception escaping an action does not reach the browser as a raw HTTP 500 (which no renderer can show). The endpoint answers an error toast instead:

  • throw a UserFacingException (Mateu.Uidl) for a business refusal — its message (and optional title) is shown as is: throw new UserFacingException("The booking is already checked in");
  • any other exception is a failure: the user sees a generic message with a correlation id (the trace id), and the exception is logged with the same id. In the Development environment the message is shown too; o.DetailedErrors = true/false overrides that.

Mateu’s own diagnostics (an unparseable YAML definition, a broken routes.yaml, a proxied endpoint that failed, a wire value that could not be converted) are logged as warnings through the app’s ILoggerFactory under Mateu.* categories.

Section titled “Navigation links, radio groups & adaptive layout”

[LinkTo("/customers/${state.customerId}")] puts a navigation icon on a field (templates are interpolated client-side); implement ILinkSupplier.Link(memberName) for runtime decisions. [UseRadioButtons] forces an enum to render as a radio group, and [AutoLayout] enables the adaptive layout inference (small enums become radios, long forms fold, section-heavy forms become tabs) — the same heuristics as the Java server.

An [AppContext] member of the app class becomes a selector on the app header that fixes a value for EVERY screen (the active hotel, the company…). An enum property contributes its constants; a method returns the options. The picked value travels in the appState of every request:

using Mateu.Dtos; // OptionDto
using Mateu.Uidl;
[App("Backoffice")]
public class BackofficeApp
{
[AppContext("Hotel")]
public IReadOnlyList<OptionDto> Hotel() =>
hotels.Select(h => new OptionDto(h.Id, h.Name)).ToList();
}

[Signature] renders a string property as a drawing pad (the accepted strokes land in the value as a PNG data URI) and [PhotoCapture] as a camera capture (JPEG data URI) — no upload endpoint, the image travels in the string. [TreeSelect(leavesOnly: true)] unfolds the field’s dropdown as a TREE; the hierarchy comes from the view implementing IOptionsSupplier with options carrying Children:

[UI("checkin")]
public class CheckIn : IOptionsSupplier
{
[Signature] public string GuestSignature { get; set; } = "";
[PhotoCapture] public string DocumentPhoto { get; set; } = "";
[TreeSelect] public string Zone { get; set; } = "";
public IReadOnlyList<Option> Options(string fieldName) =>
fieldName == "zone"
? [new Option("es", "Spain", [new Option("mca", "Mallorca")]), new Option("pt", "Portugal")]
: [];
}

By default Fetch() returns rows and the framework filters/sorts/paginates in memory. For real databases override Find — run search+filter+sort+paginate as one query (count + page inside) and the in-memory pipeline is skipped entirely:

public class Orders : Crud<Order>
{
public override IEnumerable<Order> Fetch(string? s) => throw new NotSupportedException();
public override PageResult<Order>? Find(
string? searchText, IReadOnlyDictionary<string, object?> filters, Pageable pageable)
{
var query = db.Orders.Where(...searchText, filters...); // filters = raw component
var total = query.Count(); // state: <field>, and
var page = query.OrderBy(...pageable.Sort...) // <field>_from/_to bounds,
.Skip(pageable.Page * pageable.Size).Take(pageable.Size); // multi-selects as lists
return new PageResult<Order>(page.ToList(), total);
}
}

(The C# analogue of Java’s CrudStore.find.)

Several Mateu backends compose into one shell at runtime — the frontend does the fetching, no server-side proxying:

[App("Back office")]
[RemoteMenu("Payments", "https://payments.example.com")] // nests the remote menu
[RemoteMenu("Billing", "https://billing.example.com", Explode = true)] // inlines its entries
[RemoteMenu("", "https://workflow.example.com", Path = "/workflow")] // the remote names it
public class Shell { ... }

A non-blank label is the shell’s: it wins over the one the remote answers with (shellLabel). A blank one shows the path’s last segment until the remote answers with its own. Path is where the remote’s screens live in this shell (Java’s @Menu field name): it travels as the option’s routePrefix, so the renderer knows the active section and the first breadcrumb on a cold load.

A record master opened from a listing offers ONE ”← Parent” link instead of the breadcrumb trail:

[UI("customers/7"), App("Customer", BackLink = BackLink.Parent)]
public class CustomerMaster { ... }

The link goes to the nearest route above the app’s that resolves to a screen (/customers) and is labelled with that screen’s [Title], else its last segment humanized — resolved on the server. An AppShell returned by an IAppSupplier decides with its own BackLink; a YAML shell with backLink: PARENT (its pageTitle: names the installed app when it has no title:). Java’s @App(backLink = PARENT).

To embed a remote view as an island inside a page, put a MicroFrontend in a component tree:

public IComponent Component() =>
new VerticalLayout { Content = [new MicroFrontend("https://billing.example.com", "/invoices")] };

The island mounts its own mateu-ux against the remote backend and runs its own sync loop.

Resolved in the server. A micro frontend can also be resolved by this server while it builds the view (resolve = SERVER): the host asks the remote and embeds the answer, falling back to the browser asking when the remote is slow or down. Remotes are registered with MateuOptions.Remotes, and the same machinery fills content slots — holes for managed content a content service provides. See MicroFrontend: .NET and Python, ContentSlot: .NET and Python and the server options.

Adapting foreign classes (component adapters)

Section titled “Adapting foreign classes (component adapters)”

Java’s ComponentAdapter SPI is available as is: an adapter renders a domain object that is NOT a Mateu view and carries no Mateu attributes, and rebuilds it from the state that comes back on an action. Adapters are discovered in the scanned assemblies, or registered as IComponentAdapter services (picked up by AddMateu).

[UI("pedido")] // routing only — the adapter owns the whole UI
public class Pedido { public string Cliente { get; set; } = "Acme"; public decimal Importe { get; set; } }
public class PedidoAdapter : ComponentAdapter<Pedido>
{
public override AdaptedView Adapt(Pedido p) => AdaptedView.Of(
new VerticalLayout { Content = [new FormField { FieldId = "cliente", Label = "Cliente" }, new Button("Guardar", "guardar")] },
state: new Dictionary<string, object?> { ["cliente"] = p.Cliente },
actions: ["guardar"]);
public override Pedido Deserialize(IReadOnlyDictionary<string, object?> state)
{
var p = new Pedido(); // the initial load passes an EMPTY state:
if (state.TryGetValue("cliente", out var c)) p.Cliente = (string)c!; // overwrite only what came
return p;
}
}

An action listed in Actions runs the method of that name on the rebuilt model. A property of an adapted type on a normal form renders as an independent island that round-trips through the adapter on its own.

A property whose type is a routed [UI] view embeds that view as an independent island: its own server-side type, actions and state, inside the host page. The host seeds it by setting the property — the value’s simple properties (ids, flags) become the island’s initial state. [Inline] drops the island’s own chrome (badges, KPIs, the card around a single section; the title demoted) so it blends into the host section or tab. An island action that returns a routed view re-renders the island in place — the way to build an element with several server-decided states (empty → data → editor).

[UI("documento"), Title("Documento")]
public class DocumentoView { public string? StayId { get; set; } /* … state-dependent fields … */ }
[UI("check-in/:id"), Title("Check-in")]
public class CheckIn
{
[Section("Identidad"), Inline] public DocumentoView Documento { get; set; } = new() { StayId = "42" };
}

CsvExportable, ExcelExportable and PdfExportable (on Crud<T>, on Listing<F,R>, or on any listing implementing ICrudExports) add Export CSV / Excel / PDF to the listing toolbar. Each exports the WHOLE filtered result set (search text, filters and sort — not just the page) and answers a DownloadFile.

Mateu ships no spreadsheet or PDF engine: the file is written by an IListingExporter you register as a service, one per ExportFormat. It receives a ListingExport (format, title, columns, every filtered row, search text) and returns an ExportedFile (bytes, plus an optional media type and filename — null takes export.xlsx / export.pdf / export.csv). The Excel / PDF buttons show only while an exporter for that format is registered. CSV has a built-in, dependency-free writer, which a CSV exporter of yours replaces. A starting point with ClosedXML (your dependency, not Mateu’s):

public sealed class ExcelExporter : IListingExporter
{
public ExportFormat Format => ExportFormat.Excel;
public ExportedFile Export(ListingExport export)
{
using var book = new XLWorkbook();
var sheet = book.AddWorksheet("Export");
for (var c = 0; c < export.Columns.Count; c++)
sheet.Cell(1, c + 1).Value = export.Columns[c].Label;
for (var r = 0; r < export.Rows.Count; r++)
for (var c = 0; c < export.Columns.Count; c++)
sheet.Cell(r + 2, c + 1).Value = export.Columns[c].TextOf(export.Rows[r]);
using var stream = new MemoryStream();
book.SaveAs(stream);
return new ExportedFile(stream.ToArray());
}
}
builder.Services.AddSingleton<IListingExporter, ExcelExporter>();

On a listing whose row type has a [GroupBy] column, a method marked [GroupAction("Label")] becomes a button on every group header row; a string parameter receives the clicked group’s value. Implement IGroupActionVisibility to hide it on some groups. When a custom listing returns rows without computing groups, the server synthesizes the group counts from them.

REST source catalogue and business components

Section titled “REST source catalogue and business components”

Name an endpoint once and reference it everywhere: specs/ui/sources.yaml (authored, wins), or [RestSource("countries", "https://…")] on a registered view / an IRestSourceCatalogSupplier class (derived). A surface then says [RestOptions(Source = "countries")]. The catalogue travels to the client on the app metadata (restSources), so a statically deployed screen can be re-pointed without a rebuild, and a proxied source is resolved from the SERVER’s table — its ${secret.KEY} never reaches the browser. A view assembled at runtime declares its sources by implementing IRestSourceSupplier; they gate and resolve the proxy exactly like the attributes.

Business components work the same way: specs/ui/components.yaml, [BusinessComponent("name")] or an IComponentCatalogSupplier name a bound composition, and new ComponentRef("name") (or type: ComponentRef in YAML) places it; the server expands it before it reaches the wire.

A YAML definition bound to a view model can carry layoutDelta: instead of a full layout: — what a person changed about the INFERRED layout (hidden fields, label/colspan overrides, order within a container), anchored to field ids and re-applied on every render, so the screen keeps following its model. A delta that cannot be applied is logged and the inferred layout renders.

Any Mateu property/method attribute can decorate an attribute class, so one domain word can bundle framework configuration — the C# analogue of Java’s composed annotations, resolved transitively by the mapper (first match wins, no attribute overriding):

[AttributeUsage(AttributeTargets.Property)]
[Money, Label("Importe total")]
public sealed class ImporteTotalAttribute : Attribute;
public class Invoice
{
[ImporteTotal] public decimal Total { get; set; } // behaves as [Money] + [Label(...)]
}

Routing attributes ([UI], [App]) are the exception — they stay direct, like in Java.

[AI("/ai/chat")] on the [App] class emits sseUrl in the app metadata; every renderer then shows the floating AI chat button. The endpoint is yours to implement — the chat panel POSTs

{ "message": "user text", "sessionId": "…", "menuContext": "… (first message only)" }

with Accept: text/event-stream (plus Authorization: Bearer … and X-Session-Id when available) and renders the streamed data: lines as the reply. Special data: payloads: a JSON {"event": "...", "detail": {...}} is re-dispatched on the client event bus (agent-error shows an error bubble), and a token-usage JSON updates the usage footer. A minimal ASP.NET endpoint:

app.MapPost("/ai/chat", async (HttpContext ctx, ChatRq rq) =>
{
ctx.Response.ContentType = "text/event-stream";
await foreach (var chunk in myAgent.StreamAsync(rq.Message, rq.SessionId))
await ctx.Response.WriteAsync($"data: {chunk}\n\n");
});
public record ChatRq(string Message, string? SessionId, string? MenuContext);

YAML pages: the components this server builds

Section titled “YAML pages: the components this server builds”

A specs/ui/<route>.yaml page (or a routes.yaml entry’s layout:) is built from YAML by this server: every component of the fluent catalogue, read generically off its properties (the YAML keys are the component’s attributes, camel-cased), plus Form pages, partials and ComponentRef, and a type: Listing over a REST source (rowsSource, columns, filters, searchable, pageSize — the yaml starter’s products page; the renderer fetches the rows itself). A Button whose actionable: is a RouteLink navigates; a listing’s rowRoute opens a record page. A Form may fill a design-system page template (template: — Item overview, Welcome, Dashboard landing… laid out exactly as the Java server lays them out), and a type: AppShell definition bound to the mount route is served as the app shell (menus, flows, widgets, header switches, access: per caller — or declare the shell in code, an [App] class or an IAppSupplier). A page definition’s actions: are not read yet (declare the actions on a view model). An unknown type: renders as an “Unsupported component: <type>” text.

A YAML file under <specs>/partials/ is not a page but a partial — one component, or a content: list of them, usable anywhere a component is:

specs/ui/partials/address-block.yaml
content:
- type: FormField
id: street
label: Street
- type: FormField
id: city
label: City
# any page
- type: Partial
ref: address-block

A partial standing for several components is spliced into its parent’s content, not wrapped, so one inside a form yields form fields. Partials are resolved while the tree is built and never reach the wire. A missing ref costs the partial, not the page; a cycle is broken rather than followed.

loader.Partials.Register("legal-notice",
[new Dictionary<object, object> { ["type"] = "Text", ["text"] = "Prices include VAT." }]);

Unlike the Java server, a ref here cannot name a class — the declarative form only. Full reference: Partials.

Routes can also be declared as data, in a routes.yaml next to the definitions under your specs directory (specs/ui/ by default, or MATEU_SPECS_DIR). An entry binds a definition (the layout), a viewModel and its parameters independently, so one screen can answer several routes with different parameters pinned:

routes:
- route: tickets/open
viewModel: MyApp.Views.Tickets
fixedParams:
status: open
- route: tickets/closed
viewModel: MyApp.Views.Tickets
fixedParams:
status: closed

Entries are merged over the attribute-declared views and win. Parameters resolve as fixed > client state > path > query > defaults — the same order as the Java server and the browser: a null in the client state is no value (the path, the URL’s query and the defaults still fill it), defaults only fill what nothing else supplied, and fixed ones are re-applied on the server over everything, including the state the client sends back.

viewModel takes the type’s full name. Both viewModel and view_model are accepted, since the file is the same one a Java or Python app consumes.

See the full reference, including the JSON Schema for editor completion, in Route registry. Not available in this port: the static-bundle exporter, so nothing ships the table to a browser.

The core Mateu surface is covered and verified live against this server: forms + sections + field types + validation, Crud<T> (list / detail / edit / new / save / delete), the [App] shell + menu navigation, wizards, page decorations, i18n, events, security scaffolding, the tail features above (tabs, stereotypes, KPIs, FABs, shortcuts, compact, unsaved-changes guard), the nine dashboard/UX component types (MetricCard, Scoreboard, DashboardPanel, ResponsiveGrid, FoldoutLayout, HeroSection, EmptyState, Skeleton, Gantt) and the declarative page archetypes (Dashboard, Foldout, Welcome, ItemOverview). Federated microfrontends ([RemoteMenu] + the MicroFrontend component) and the SSE/AI chat entry point ([AI] → the app’s SseUrl) are wired through the mapper as well. Over 750 tests cover this port, including a golden-JSON wire-conformance corpus (WireConformanceTests) that checks the emitted JSON against shared expected.json snapshots derived from the Java reference.

The shared wire-conformance corpus is a hard gate for this port: WireConformanceTests fails on any difference from the Java reference outside a short, path-scoped allow-list of defects in the Java goldens themselves (see the test for the reasons).