.NET 10 • Clean Architecture • Production-Ready

Ship B2B Integrations
in Days, Not Months

A production-ready .NET 10 API template with Clean Architecture, CQRS, file processing, field mapping, and API key authentication. Stop rebuilding boilerplate — start building features.

5
Architecture Layers
10+
Built-in Transforms
70+
Unit Tests
MIT
Licensed
.NET 10
Entity Framework Core
MediatR (CQRS)
FluentValidation
Serilog
MudBlazor UI

Everything You Need for B2B Integrations

Built with best practices so you can focus on business logic, not plumbing.

▶ Click any feature to see the code

🏗

Clean Architecture

Domain, Application, Infrastructure, and API layers with proper dependency inversion. Testable, maintainable, and scalable from day one.

5 Layers, Zero Ambiguity

Every file has exactly one place to live. The dependency rule flows inward — outer layers depend on inner layers, never the reverse.

  • Domain — entities, interfaces, business rules. No framework dependencies.
  • Application — use cases, CQRS commands/queries, validation.
  • Infrastructure — EF Core, file services, external integrations.
  • API — controllers, middleware, DI wiring.
  • Web — Blazor UI, HTTP client to API.
// Domain layer — no framework imports
public class FileTemplate : AuditableEntity
{
    public string Name        { get; set; }
    public FileType FileType   { get; set; }
    public bool HasHeaderRow  { get; set; }
    public IList<ColumnDef> Columns { get; set; }
}

// Infrastructure implements the interface
// defined in Domain — dependency flows inward
public class FileTemplateRepository
    : GenericRepository<FileTemplate>
    , IFileTemplateRepository
{
    public FileTemplateRepository(AppDbContext db)
        : base(db) { }

    public async Task<IList<FileTemplate>>
        GetWithColumnsAsync() =>
            await _db.FileTemplates
                .Include(t => t.Columns)
                .ToListAsync();
}

CQRS with MediatR

Commands and Queries separated cleanly. Built-in validation pipeline, logging behaviors, and exception handling baked right in.

Pipeline Behaviors — Wired Up for You

Validation and logging run automatically for every command. You write the handler; the pipeline takes care of the rest.

  • Validation fires before your handler — invalid requests never reach business logic.
  • Unhandled exceptions surface as structured Problem Details responses.
  • Add your own behaviors (caching, metrics) by implementing IPipelineBehavior.
// 1. Define the command
public record CreateTemplateCommand(
    string Name,
    FileType Type,
    List<ColumnDef> Columns
) : IRequest<Guid>;

// 2. Validation — runs automatically
public class CreateTemplateValidator
    : AbstractValidator<CreateTemplateCommand>
{
    public CreateTemplateValidator()
    {
        RuleFor(x => x.Name).NotEmpty().MaximumLength(200);
        RuleFor(x => x.Columns).NotEmpty();
    }
}

// 3. Handler — just your business logic
public class CreateTemplateHandler
    : IRequestHandler<CreateTemplateCommand, Guid>
{
    public async Task<Guid> Handle(
        CreateTemplateCommand cmd, CancellationToken ct)
    {
        var template = new FileTemplate { Name = cmd.Name };
        await _repo.AddAsync(template, ct);
        return template.Id;
    }
}
📄

File Processing Engine

Parse CSV, TSV, and Excel (.xlsx) with auto-detection. Header row detection, schema inference, and paginated result sets out of the box.

CSV, TSV, and Excel — One Interface

Send any file to the parse endpoint. The IFileParserServiceFactory routes to the right parser based on format — CSV/TSV via the built-in parser, Excel via ClosedXML. Results come back in the same shape regardless of input format.

  • Auto-detects comma, pipe, tab, and custom delimiters.
  • Excel (.xlsx) support via ClosedXML — cell types, date formatting, configurable sheet selection by index or name.
  • Schema detection infers column types from sample rows.
  • PagedResult<T> base class for paginated queries — page, pageSize, totalCount, hasNextPage.
  • Returns structured rows — not raw strings.
// POST /api/fileprocessing/parse
// multipart/form-data: file + optional templateId

// Input CSV:
CustomerID,Name,OrderDate,Amount
C001,Acme Corp,2026-01-15,1250.00
C002,Globex Inc,2026-01-16,875.50

// Response:
{
  "rowCount": 2,
  "columns": [
    { "name": "CustomerID", "type": "String"  },
    { "name": "OrderDate",  "type": "DateTime"},
    { "name": "Amount",     "type": "Decimal" }
  ],
  "rows": [
    { "CustomerID": "C001", "Name": "Acme Corp",
      "OrderDate": "2026-01-15", "Amount": 1250.00 },
    ...
  ]
}
🔄

Field Mapping & Transforms

10+ built-in data transforms — uppercase, date format, substring, replace, pad, concatenate, and more. Map any source to any target format.

Describe the Transform, Not the Code

Define mappings as JSON — rename columns, reformat dates, normalize casing, inject constants, and chain transforms without writing parser code for each client.

  • RenameCustomerIDcustomer_id
  • DateFormat01/15/20262026-01-15
  • Uppercase / Lowercase / Trim
  • Substring / Replace / Regex
  • Concatenate with prefix/suffix
  • PadLeft / PadRight to fixed width
  • Split — extract element N from a delimited value
  • Lookup — map values via a JSON dictionary (e.g. state codes → full names)
  • DefaultValue for missing source fields
// POST /api/fileprocessing/transform
{
  "mappings": [
    {
      "sourceColumn": "CustomerID",
      "targetColumn": "customer_id",
      "transform": { "type": "None" }
    },
    {
      "sourceColumn": "Name",
      "targetColumn": "customer_name",
      "transform": { "type": "Uppercase" }
    },
    {
      "sourceColumn": "OrderDate",
      "targetColumn": "order_date",
      "transform": {
        "type": "DateFormat",
        "parameters": {
          "inputFormat":  "MM/dd/yyyy",
          "outputFormat": "yyyy-MM-dd"
        }
      }
    },
    {
      "sourceColumn": null,
      "targetColumn": "source_system",
      "defaultValue": "CLIENT_A"
    }
  ]
}
🔐

API Key Authentication

Secure B2B client authentication with key management, expiry, and per-client endpoint restrictions. Ready for multi-tenant scenarios.

Per-Client Keys with Endpoint Scoping

Each B2B client gets their own API key stored in the database. Keys can be scoped to specific endpoints, given an expiry date, and revoked without a deploy.

  • Validates X-Api-Key header on every request.
  • Health check and OpenAPI endpoints are public — everything else requires a key.
  • Optional endpoint allow-list per client (e.g., client A can only call /api/fileprocessing).
  • Last-used timestamp updated automatically for audit trails.
  • Returns structured 401/403 JSON — never HTML error pages.
// Middleware registered in Program.cs
app.UseMiddleware<ExceptionHandlingMiddleware>();
app.UseApiKeyAuthentication();  // ← here
app.MapControllers();

// Create a client key in SQL:
INSERT INTO ApiClients
  (Id, Name, ApiKey, IsActive, AllowedEndpoints)
VALUES
  (NEWID(), 'Acme Corp', 'acme-key-abc123',
   1, '["/api/fileprocessing"]');

// Client calls the API:
curl -X POST https://api.yourco.com/api/fileprocessing/parse \
  -H "X-Api-Key: acme-key-abc123" \
  -F "file=@orders.csv"

// Unauthorized response (no key):
{ "error": "API key is required" }  // 401

// Scoped endpoint violation:
{ "error": "Access to this endpoint is not allowed" } // 403

Background Jobs, SFTP & Delivery

Channel-backed job queue, SignalR live progress, SFTP/FTP transfer, and outbound webhook/email delivery — production async pipeline ready to wire up.

The Full Async Pipeline

Four production patterns wired together — enqueue a file job, track its progress in real time, fetch from SFTP, and push results to a webhook or email when done.

  • IBackgroundTaskQueue — Channel<T>-backed, bounded, drained by a hosted service. Enqueue any work item without blocking the request.
  • SignalR Progress Hub — clients subscribe to a jobId group; the server pushes JobProgress, JobCompleted, JobFailed events in real time.
  • IFileTransferService — SFTP (SSH.NET) and FTP/FTPS (FluentFTP) behind one interface: list, download, upload, move, delete.
  • IDestinationProvider — HTTP webhook and email (MailKit) destinations. Multiple providers registered as IEnumerable<IDestinationProvider> — add new ones without touching existing code.
// Enqueue a file import job from a controller
await _queue.QueueAsync(async ct =>
{
    await _notifier.NotifyProgressAsync(
        jobId, 10, "Fetching from SFTP...", ct);

    using var stream = await _sftp
        .DownloadAsync("/inbox/orders.csv", ct);

    await _notifier.NotifyProgressAsync(
        jobId, 50, "Parsing rows...", ct);

    var result = await _parser
        .ParseAsync(stream, options, ct);

    await _notifier.NotifyProgressAsync(
        jobId, 90, "Sending to partner...", ct);

    foreach (var dest in _destinations
        .Where(d => d.Supports(config.Type)))
        await dest.SendAsync(payload, config, ct);

    await _notifier.NotifyCompletedAsync(
        jobId, "Import complete.", ct);
}, cancellationToken);

What's Included

A complete, ready-to-customize solution — not a toy demo.

Full Source Code

Complete .NET 10 solution with all 5 projects — no hidden dependencies or locked-down libraries.

API Layer (Controllers + Middleware)

RESTful endpoints for file templates, field mappings, file processing, and health checks.

Application Layer (CQRS)

Commands, queries, validators, and MediatR pipeline behaviors — all wired up.

Domain Layer (Entities + Interfaces)

Clean domain model with base entities, repository interfaces, and domain logic.

Infrastructure Layer (EF Core + Services)

SQL Server persistence, file parser, field mapping engine, export service, transfer services — all implemented.

Blazor Web Dashboard

MudBlazor admin UI with file upload, template management, transform preview, and dark mode.

Excel (.xlsx) Support

ClosedXML-backed parser behind the same IFileParserService interface. Route by format via IFileParserServiceFactory — no breaking changes to existing CSV code.

Background Job Queue

Channel-backed IBackgroundTaskQueue with a hosted service consumer. Enqueue any async work item without blocking the HTTP pipeline. Configurable bounded capacity.

SignalR Progress Hub

Real-time job progress via IProgressNotifier. Background workers push JobProgress, JobCompleted, and JobFailed events to connected clients by job group.

SFTP & FTP Transfer Service

SSH.NET (SFTP) and FluentFTP (FTP/FTPS) behind a single IFileTransferService interface — list, download, upload, move, delete. Register SFTP or FTP with one line in startup.

Outbound Destination Pipeline

HTTP webhook and email (MailKit) delivery via IDestinationProvider. Multiple destinations registered as IEnumerable — add a new delivery channel without touching existing providers.

Paginated Query Base Classes

PagedResult<T> and PagedQuery<T> base types for any list endpoint. Page, PageSize, TotalCount, HasNextPage — demonstrated with a paginated Todos query.

Unit Test Suite

Comprehensive test coverage for domain logic, application layer, and services.

Documentation & Getting Started Guide

README with setup instructions, API reference, configuration guide, and examples.

Structured Logging (Serilog)

Console and file sinks with rolling log files. Production-ready logging configuration.

Health Checks

Database connectivity monitoring endpoint. Ready for container orchestration and uptime monitoring.

Global Exception Handling

Consistent error responses using Problem Details (RFC 7807). No unhandled exceptions leaking to clients.

Deployment Scripts

Deploy wherever you want — Docker Compose, Windows Service, IIS, or Linux systemd. PowerShell and Bash scripts included. Publish with one command, deploy to your server of choice.

Why this exists

We built this because we needed it.

B2B integrations kept starting the same way — file parsing, field mapping, API key auth, async processing, outbound delivery. Every project. Every time. The architecture decisions were the same. The boilerplate was the same. The only thing that changed was the client.

This template is the foundation we wish we'd had. Not a tutorial project, not a demo — the actual structure we reach for when starting integration work. Clean Architecture so every file has one place to live. CQRS so commands and queries don't bleed into each other. A file processing engine that handles the real-world messiness of CSV, TSV, and Excel from actual clients.

MIT licensed. No strings attached. Take it, change it, ship it.

Simple, One-Time Pricing

Pay once, use forever. No subscriptions, no recurring fees.

⚡ Launch pricing — use code EARLYBIRD at checkout
Standard
$40
$69  one-time • code: EARLYBIRD
  • Complete .NET 10 solution
  • All 5 architecture layers
  • File processing engine
  • Field mapping & transforms
  • API key authentication
  • Unit test suite
  • Documentation & examples
  • MIT License
Get Standard — $40

Built on Real-World Experience

This template was extracted from production B2B systems processing real integrations daily.

★★★★★

"The architecture patterns in this template come directly from systems handling thousands of EDI and ERP transactions per day — not theoretical code."

🛠
Battle-Tested Codebase
Extracted from production B2B integrations
★★★★★

"Every pattern here — CQRS, repository abstraction, middleware pipeline — was chosen to solve real problems: testability, maintainability, and scale."

📄
Clean Architecture by Design
Not academic — chosen under production pressure
★★★★★

"The field mapping engine handles the messy reality of B2B data: inconsistent formats, missing fields, and client-specific transform requirements."

🔄
Handles Real-World Messiness
10+ built-in transforms, extensible by design

Frequently Asked Questions

The template targets .NET 10. You'll need the .NET 10 SDK installed. It uses the latest C# language features and modern .NET APIs.

Yes! The template is MIT licensed. Use it for client projects, internal tools, SaaS products — whatever you need. No attribution required.

SQL Server via Entity Framework Core. It works with LocalDB for development and any SQL Server edition for production. The repository pattern makes it straightforward to swap to another database provider if needed.

Standard tier includes the current version as-is. Extended tier includes future updates — you'll receive download links when new versions are released.

Yes — 30-day money-back guarantee, no questions asked. If the template isn't right for your project, just reach out for a full refund.

Standard includes the API, domain, application, and infrastructure layers with full file processing capabilities. Extended adds the Blazor admin dashboard, deployment scripts, production logging config, future updates, and 30 days of priority email support.

Ready to Ship Faster?

Stop spending weeks on boilerplate. Get a production-ready foundation and start building real features today.

🚀 Get the Starter Kit — From $40 $69
🛡 30-day money-back guarantee • MIT License • Instant download