How should you organize code in a MAUI project?
Short answer
Use feature folders (or layered folders: Views, ViewModels, Services, Models) and consider separate class libraries for domain/core and infrastructure so logic is reusable and testable. Keep the MAUI head focused on UI.
Advertisement
AModel answer
Use feature folders (or layered folders: Views, ViewModels, Services, Models) and consider separate class libraries for domain/core and infrastructure so logic is reusable and testable. Keep the MAUI head focused on UI. Group platform code under Platforms and shared resources under Resources.
Example
/Features/Orders/OrdersPage.xaml /Features/Orders/OrdersViewModel.cs /Core/Services/IOrderService.cs /Infrastructure/Api/OrderApiClient.cs
Real-world example
Grouping each feature's view, view model, and services together makes navigation and ownership clear as the app grows.
Likely follow-ups
- Feature folders vs layered folders? | Why extract a core library?
Related topics