Module-based handler pipelines, compile-time registration, JSON-RPC hosting, MCP tools for AI agents, and scheduled jobs.
Declare intent next to your code; let source generators do the wiring. No runtime reflection scanning.
AI-native by design: the same handlers that power your API are exposed to AI agents as MCP tools — generated from your code at compile time, with no separate tool definitions or duplicated schemas.
Elarion's central idea is simple: your application assemblies define modules and handlers; your
host assembly only wires infrastructure, transport, and deployment. Everything that can be
discovered from your code — handlers, validators, services, scheduled jobs, RPC methods, EF Core
DbSets — is emitted by source generators at compile time instead of scanned by reflection at
startup.
[RpcMethod("clients.get")]
public sealed class GetClient(IAppDbContext db)
: IHandler<GetClient.Query, Result<GetClient.Response>> {
public sealed record Query(Guid Id);
public sealed record Response(Guid Id, string Name);
public async ValueTask<Result<Response>> HandleAsync(Query query, CancellationToken ct) {
var client = await db.Clients
.Where(c => c.Id == query.Id)
.Select(c => new Response(c.Id, c.Name))
.FirstOrDefaultAsync(ct);
return client is null
? AppError.NotFound($"Client {query.Id} was not found.")
: client;
}
}That one class is a use case, a registered service, a JSON-RPC method, an MCP tool for AI agents,
and (optionally) a schema-exported TypeScript contract — with no entry added to any Program.cs
registration list.
- Compile-time, not reflection — handlers, services, validators, modules, RPC maps, and scheduled jobs become ordinary DI code. Startup is deterministic and AOT-friendly; missing wiring is a build error, not a runtime surprise.
- Modules own their surface — a module is a namespace plus an
[AppModule]marker. Add a handler under it and the module publishes it automatically. - Transport-neutral results — handlers return
Result<T>with a transport-agnosticAppError; the host maps failures to JSON-RPC, HTTP, or anything else. - End-to-end JSON-RPC — mark a handler with
[RpcMethod], export a schema at build time, and generate a typed TypeScript + Zod client. - AI-native, no extra code — expose the same
[RpcMethod]handlers to AI agents as an MCP server, an independent transport with its own dispatcher. Tool names, descriptions, and input schemas are generated from your handlers and[Description]attributes at compile time — no separate tool layer, no duplicated schemas, no runtime reflection. Choose a handler's transports with[RpcMethod(Transports = …)](JSON-RPC, MCP, or both) and rename a tool with[McpMethod]. - In-process scheduling — source-generated scheduled jobs with explicit overlap, misfire, and resilience policies.
- Observable by default — JSON-RPC, scheduling, caching, and resilience emit
OpenTelemetry-compatible traces and metrics through
System.Diagnostics, with no SDK dependency forced on you.
<!-- Application library -->
<ItemGroup>
<PackageReference Include="Elarion" Version="0.1.0" />
<PackageReference Include="Elarion.Generators" Version="0.1.0" PrivateAssets="all" />
</ItemGroup>// Turn the generators on, once per assembly
[assembly: UseElarion]The Quickstart builds a module, a handler, and a working JSON-RPC endpoint end to end.
| Package | Purpose |
|---|---|
Elarion.Abstractions |
Attributes and contracts: [AppModule], [Service], [ScheduledJob], IHandler<,>, Result<T>, AppError. |
Elarion |
Runtime primitives: handler caches, decorators, the in-memory scheduler, resilience runtime, current-user access. |
Elarion.Blobs |
Provider-neutral blob storage contracts and DTOs. |
Elarion.Blobs.PostgreSql |
PostgreSQL-backed blob storage with EF Core model configuration and Npgsql content I/O. |
Elarion.Messaging.InMemory |
In-memory integration-event bus (best-effort, commit-gated by the EF Core transaction). |
Elarion.Messaging.Outbox |
EF Core transactional outbox: a durable, at-least-once integration-event bus with a polling delivery worker. |
Elarion.Paging |
Keyset (cursor) and offset pagination primitives, opaque cursor codec, and IQueryable paging extensions. |
Elarion.Generators |
Roslyn generators for handlers, services, validators, modules, RPC maps, HTTP endpoint maps, resilience policies, scheduled jobs, and event consumers. |
Elarion.JsonRpc |
Transport-neutral JSON-RPC dispatcher, envelopes, telemetry, and schema export. |
Elarion.AspNetCore |
ASP.NET Core JSON-RPC endpoint mapping, [HttpEndpoint] minimal-API mapping, batch execution, and current-user middleware. |
Elarion.AspNetCore.Mcp |
Exposes your JSON-RPC handlers as a Model Context Protocol (MCP) server for AI agents, over Streamable HTTP. |
Elarion.AspNetCore.SchemaGeneration |
MSBuild package that exports rpc-schema.json during dotnet build. |
Elarion.EntityFrameworkCore |
Marker attributes for generated DbSets and entity inclusion. |
Elarion.EntityFrameworkCore.Generators |
Roslyn generator for DbSet properties and entity configuration. |
@swimmesberger/elarion-jsonrpc-client-generator |
TypeScript CLI that turns a schema export into method contracts, Zod schemas, and a fetch client. |
Full guides live in docs/ and are structured for a documentation site:
- Introduction · Installation · Quickstart
- Core concepts — handlers, results & errors, modules, services, validators, pipelines, caching, current user
- Features — source generation, JSON-RPC, HTTP endpoints, MCP server, events & messaging, blob storage, scheduling, resilience, EF Core, telemetry
- Reference — packages, configuration, vs. ASP.NET Core, troubleshooting
- .NET 10 SDK or later
- ASP.NET Core for the JSON-RPC HTTP transport
- Node.js 18+ for the TypeScript client generator
Issues and pull requests are welcome. See CONTRIBUTING.md for the development workflow, validation commands, architecture boundaries, and the publishing process. By participating you agree to the Code of Conduct.
Please report vulnerabilities privately — see the security policy.
Elarion is licensed under the Apache License 2.0.