- 
                Notifications
    You must be signed in to change notification settings 
- Fork 32
✨ Migrate from Minimal APIs to FastEndpoints #198
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
…nDbContext and event publisher
… using directives in Fast Endpoints
…nt settings and JSON serializer options
…DependencyInjection
… and remove unused code
…s returned to the user.
…nd GetTeam endpoints to enhance API documentation
…am, CompleteMission, ExecuteMission, GetTeam, and UpdateHero
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull Request Overview
This pull request transitions the SSW.VerticalSliceArchitecture template from ASP.NET Core Minimal APIs to FastEndpoints 7.0 as the primary API framework. The change introduces FastEndpoints infrastructure (processors, event handling, endpoint base classes), refactors all Heroes and Teams endpoints to the new pattern, removes MediatR and Scalar dependencies, and documents the architectural decision. The implementation maintains compatibility with existing domain patterns, validation, and eventual consistency while providing improved structure and developer productivity.
Key Changes
- FastEndpoints adoption: Complete migration from Minimal APIs/MediatR to FastEndpoints 7.0 with custom processors, global configuration, and Swagger integration
- Endpoint refactoring: All Heroes and Teams endpoints converted to FastEndpoints pattern with simplified request/response handling and direct database access
- Infrastructure updates: Removed MediatR behaviors, replaced with FastEndpoints processors (logging, performance, exception handling); updated event handling to route exclusively through FastEndpoints IEventinterface
Reviewed Changes
Copilot reviewed 71 out of 71 changed files in this pull request and generated 6 comments.
Show a summary per file
| File | Description | 
|---|---|
| Directory.Packages.props | Added FastEndpoints 7.0 package references | 
| src/WebApi/WebApi.csproj | Commented out MediatR/Scalar, added FastEndpoints packages | 
| src/WebApi/Program.cs | Replaced Minimal API setup with FastEndpoints middleware | 
| src/WebApi/Host/DependencyInjection.cs | Removed MediatR registration, added FastEndpoints services | 
| src/WebApi/Host/Extensions/*.cs | Deleted Minimal API helpers, added FastEndpoints configuration extensions | 
| src/WebApi/Common/FastEndpoints/*.cs | Added processors for logging, performance tracking, and exception handling | 
| src/WebApi/Features/Heroes/Endpoints/*.cs | Created FastEndpoints implementations replacing Commands/Queries | 
| src/WebApi/Features/Teams/Endpoints/*.cs | Created FastEndpoints implementations replacing Commands/Queries | 
| src/WebApi/Features/Heroes/Commands/*.cs | Deleted MediatR command files | 
| src/WebApi/Features/Teams/Commands/*.cs | Deleted MediatR command files | 
| src/WebApi/Common/Domain/Base/*.cs | Changed domain event interface from IDomainEventtoIEvent | 
| src/WebApi/Common/Middleware/EventualConsistencyMiddleware.cs | Updated to use FastEndpoints event publishing API | 
| tests/WebApi.IntegrationTests/*.cs | Updated tests to use FastEndpoints test client extensions | 
| tests/WebApi.ArchitectureTests/*.cs | Changed handler interface checks from MediatR to FastEndpoints | 
| docs/adrs/20251018-api-use-fastendpoints-instead-of-minimal-apis.md | Documented architectural decision with rationale | 
| docs/cli-tasks/*.md | Added comprehensive implementation documentation and guides | 
| tmp/VERIFY_IMPLEMENTATION.sh | Build verification script for FastEndpoints implementation | 
        
          
                tests/WebApi.IntegrationTests/Endpoints/Teams/Commands/CreateTeamCommandTests.cs
          
            Show resolved
            Hide resolved
        
              
          
                tests/WebApi.IntegrationTests/Endpoints/Teams/Commands/AddHeroToTeamCommandTests.cs
          
            Show resolved
            Hide resolved
        
              
          
                tests/WebApi.IntegrationTests/Endpoints/Heroes/Commands/CreateHeroCommandTests.cs
          
            Show resolved
            Hide resolved
        
      | Fixes #199 | 
…es to Minimal APIs
…ce usage instructions
…onsistency and improved readability
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
A few comments
        
          
                src/WebApi/Common/Persistence/Interceptors/DispatchDomainEventsInterceptor.cs
              
                Outdated
          
            Show resolved
            Hide resolved
        
              
          
                templates/slice/Features/Entities/Endpoints/CreateEntityNameEndpoint.cs
              
                Outdated
          
            Show resolved
            Hide resolved
        
      There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
This pull request introduces FastEndpoints as the primary API framework for the SSW.VerticalSliceArchitecture template, replacing the previous Minimal APIs approach. It updates dependencies, refactors infrastructure and endpoint code to align with FastEndpoints 7.0, and documents the architectural decision and build status. The changes ensure improved structure, maintainability, and developer productivity while maintaining compatibility with existing domain patterns and event handling via MediatR.
Architectural Documentation and Guidelines:
.github/instructions/adrs.instructions.md, detailing file naming, structure, content guidelines, and project-specific conventions.docs/adrs/20251018-api-use-fastendpoints-instead-of-minimal-apis.md) documenting the decision to adopt FastEndpoints over Minimal APIs, including context, drivers, options, outcomes, and consequences.Dependency and Infrastructure Updates:
Directory.Packages.propsto add FastEndpoints (7.0.0) and FastEndpoints.Swagger as dependencies, ensuring the project uses the latest version and supports OpenAPI documentation. [1] [2]Implementation and Code Refactoring:
HttpContext.Responseusage.Documentation of Build and Implementation Status:
docs/cli-tasks/BUILD_SUCCESS.md, summarizing the changes, current implementation, testing instructions, and known limitations of the FastEndpoints integration.