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.
Built with best practices so you can focus on business logic, not plumbing.
▶ Click any feature to see the code
Domain, Application, Infrastructure, and API layers with proper dependency inversion. Testable, maintainable, and scalable from day one.
Every file has exactly one place to live. The dependency rule flows inward — outer layers depend on inner layers, never the reverse.
// 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(); }
Commands and Queries separated cleanly. Built-in validation pipeline, logging behaviors, and exception handling baked right in.
Validation and logging run automatically for every command. You write the handler; the pipeline takes care of the rest.
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; } }
Parse CSV, TSV, and Excel (.xlsx) with auto-detection. Header row detection, schema inference, and paginated result sets out of the box.
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.
PagedResult<T> base class for paginated queries — page, pageSize, totalCount, hasNextPage.// 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 }, ... ] }
10+ built-in data transforms — uppercase, date format, substring, replace, pad, concatenate, and more. Map any source to any target format.
Define mappings as JSON — rename columns, reformat dates, normalize casing, inject constants, and chain transforms without writing parser code for each client.
CustomerID → customer_id01/15/2026 → 2026-01-15// 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" } ] }
Secure B2B client authentication with key management, expiry, and per-client endpoint restrictions. Ready for multi-tenant scenarios.
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.
X-Api-Key header on every request./api/fileprocessing).// 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
Channel-backed job queue, SignalR live progress, SFTP/FTP transfer, and outbound webhook/email delivery — production async pipeline ready to wire up.
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.
JobProgress, JobCompleted, JobFailed events in real time.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);
A complete, ready-to-customize solution — not a toy demo.
Complete .NET 10 solution with all 5 projects — no hidden dependencies or locked-down libraries.
RESTful endpoints for file templates, field mappings, file processing, and health checks.
Commands, queries, validators, and MediatR pipeline behaviors — all wired up.
Clean domain model with base entities, repository interfaces, and domain logic.
SQL Server persistence, file parser, field mapping engine, export service, transfer services — all implemented.
MudBlazor admin UI with file upload, template management, transform preview, and dark mode.
ClosedXML-backed parser behind the same IFileParserService interface. Route by format via IFileParserServiceFactory — no breaking changes to existing CSV code.
Channel-backed IBackgroundTaskQueue with a hosted service consumer. Enqueue any async work item without blocking the HTTP pipeline. Configurable bounded capacity.
Real-time job progress via IProgressNotifier. Background workers push JobProgress, JobCompleted, and JobFailed events to connected clients by job group.
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.
HTTP webhook and email (MailKit) delivery via IDestinationProvider. Multiple destinations registered as IEnumerable — add a new delivery channel without touching existing providers.
PagedResult<T> and PagedQuery<T> base types for any list endpoint. Page, PageSize, TotalCount, HasNextPage — demonstrated with a paginated Todos query.
Comprehensive test coverage for domain logic, application layer, and services.
README with setup instructions, API reference, configuration guide, and examples.
Console and file sinks with rolling log files. Production-ready logging configuration.
Database connectivity monitoring endpoint. Ready for container orchestration and uptime monitoring.
Consistent error responses using Problem Details (RFC 7807). No unhandled exceptions leaking to clients.
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.
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.
Pay once, use forever. No subscriptions, no recurring fees.
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."
"Every pattern here — CQRS, repository abstraction, middleware pipeline — was chosen to solve real problems: testability, maintainability, and scale."
"The field mapping engine handles the messy reality of B2B data: inconsistent formats, missing fields, and client-specific transform requirements."
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.
Stop spending weeks on boilerplate. Get a production-ready foundation and start building real features today.
🚀 Get the Starter Kit — From $40 $69