Skip to content
@n-framework

NFramework

NFramework

Compile-time-first application framework and workspace standard for building clean architecture services.

NFramework removes the runtime bloat, reflection-heavy startup, vendor lock-in, and inconsistent structure of traditional enterprise frameworks. It gives teams a fast, opinionated way to scaffold services, enforce architecture boundaries, generate boilerplate safely at compile time, and operate services in modern cloud environments from day one.

The first delivery focus is a .NET 11 reference implementation that proves the core architecture, developer experience, and Native AOT readiness. The long-term vision is a polyglot ecosystem across .NET, Go, and Rust with MCP-compatible tool and agent integrations.


🤔 Why NFramework

Teams building modern microservices keep hitting the same walls:

  • Frameworks lean on runtime reflection, slowing startup and breaking Native AOT.
  • Clean Architecture rules are documented but not enforced, so boundaries decay.
  • New services need large amounts of manual scaffolding and duplicate boilerplate.
  • Infrastructure leaks into application and domain layers, hurting testability.
  • Polyglot teams struggle to keep one architecture, naming, and contract model across languages.
  • Cloud-native building blocks (telemetry, messaging, state, orchestration) get bolted on late.

NFramework answers these with a unified CLI, compile-time code generation, strict layer rules, and a clear path from local development to distributed deployment.


🧭 Product Principles

  1. Clean Architecture & Clean Code by Default — Layer boundaries, dependency direction, explicit result types, and generated structure reinforce separation of concerns without manual discipline.
  2. Pure Core — Domain and application layers never depend on persistence, messaging, or HTTP libraries directly.
  3. Zero-Dependency Layers with Replaceable Adapters — Framework packages carry no external dependencies; integrations live in separate adapters that depend on abstractions, never the reverse.
  4. Exception-Free Business Flow — Workflows prefer Result<T> over exceptions for expected outcomes.
  5. Compile-Time Magic Over Runtime Magic — DI registration, route discovery, and boilerplate are generated at build time.
  6. Ready for Microservices — Telemetry, logging, metrics, health checks, and observability are part of the generated baseline.
  7. One Standard, Many Languages — The workspace model, folder structure, and contracts stay stable across languages.

⚡ The nfw CLI

A single CLI-driven workflow for creating and evolving NFramework workspaces and services, with both interactive and non-interactive modes.

nfw templates                                   # List available starter templates
nfw new my-workspace --template <id> --no-input # Create a workspace
nfw add service Orders --lang dotnet            # Scaffold Domain/Application/Infrastructure/Api
nfw add entity Product                          # Create the entity class
nfw add crud Product --props Name:string,Price:decimal  # Full CRUD scaffold for an entity
nfw add command ApproveOrder Orders             # Standalone command flow
nfw add query GetOrderByNumber Orders           # Standalone query flow
nfw check                                        # Validate architecture boundaries (CI-friendly)

Generation supports opt-in feature settings for caching, logging, transaction, secured operation, and API exposure, and an interactive TUI for workspace management, creation wizards, a command palette, and real-time diagnostics.


📦 What's in the Box (.NET Beta)

Area What you get
Domain Base abstractions for Entity<TId>, AggregateRoot, ValueObject, DomainEvent
Application Result / Result<T>, CQRS contracts (commands, queries, events, stream requests, behaviors), business rules, pageable requests
CQRS pipeline Framework-native command/query dispatch, compatible with the Result-based flow
Source generators Deterministic DI registration and Minimal API routes — no runtime assembly scanning
Persistence Abstract repository contracts (CRUD, paging, dynamic querying, bulk ops, migrations) + EF Core adapter
Security JWT auth, refresh tokens, authorization, operation claims, email/OTP authenticators
Cross-cutting Abstractions + adapters for validation, mapping, logging, problem details, localization, translation, mailing, search
Architecture audit nfw check fails fast on forbidden references and namespace usage

First-party adapters in beta: EF Core (persistence), FluentValidation (validation), Mapster / manual mapping, Serilog (logging).


🗺️ Roadmap at a Glance

In scope for beta — .NET-first, execution-focused: CLI + TUI, source-generated DI & routes, framework-native CQRS, topic abstractions with adapters, single-command build & test, quickstart docs.

Planned post-beta:

  • Aspire AppHost + ServiceDefaults for distributed local dev and observability
  • Dapr adapters for pub/sub, state management, and secret store
  • nfw up local orchestration
  • Go and Rust service scaffolding on the same workspace standard
  • MCP-compatible tool and agent integrations
  • Protobuf-first contract generation and nfw sync cross-language sync (gRPC)

Delivery sequencing lives in the per-repository roadmap.


🎯 Success Targets

  • A generated "hello world" .NET service builds with 0 AOT / trimming warnings.
  • A standard service cold-starts in < 50 ms under benchmark conditions.
  • Generating a CRUD flow takes < 10 seconds to a buildable endpoint.
  • Creating a new workspace completes in < 1 second.
  • A .NET developer can understand a generated Go service in ≤ 10 minutes.

🚫 Non-Goals

  • ASP.NET MVC / controller-based scaffolding
  • Runtime-reflection fallbacks for compile-time features
  • Hiding generated code — it stays inspectable and debuggable
  • Exception-driven business flow as a primary pattern

NFramework — clean architecture, Native AOT, and CLI-driven automation as non-negotiable foundations.

Popular repositories Loading

  1. n-framework n-framework Public

    🚧 WIP

    Shell 1 1

  2. nfw nfw Public

    Rust 1 1

  3. nfw-generators nfw-generators Public

    Shell 1 1

  4. .github .github Public

    1 1

  5. website website Public

    MDX 1 1

  6. core-mediator-dotnet core-mediator-dotnet Public

    C# 1 1

Repositories

Showing 10 of 12 repositories

Top languages

Loading…

Most used topics

Loading…