How respawnsive/starcellar works
Project Type and Purpose
• This is a full-stack sample application demonstrating how to use Apizr, a resilient Refit-based HTTP client manager, within a .NET MAUI cross-platform app (“StarCellar.App”), backed by a .NET 6 Web API (“StarCellar.Api”) and an EF Core SQL database.
• The README confirms it’s an end-to-end tutorial repository with two flavors of the client (With.Apizr and Without.Apizr) illustrating progressively advanced Apizr features (retry, caching, auth, logging, etc.).
File Structure Analysis
• Top-level folders:
• StarCellar.Api – .NET Web API
• StarCellar.App – .NET MAUI app (two sub-projects: With.Apizr and Without.Apizr)
• Api subfolders:
• Data – EF Core DbContext, entities (User, Wine, Token, RefreshToken)
• Migrations – EF Core migration code
• Handlers – HTTP request handlers or controllers (FilesHandler, UsersHandler, WinesHandler)
• Utils – token generator/validator, email validator, claim converter
• appsettings.json – configuration for DB connections, JWT, etc.
• App (With.Apizr):
• Views (Xamarin/.NET MAUI Pages), ViewModels (MVVM), Services/Apis (interfaces Dtos, Refit APIs), NavigationService
• Platform folders (Android, iOS, Windows, MacCatalyst)
• MauiProgram.cs – dependency injection container, Apizr registration
• The Without.Apizr project mirrors the same structure but uses raw Refit or HttpClient calls instead of Apizr.
Key README Insights
• Purpose: step-by-step tutorial of Apizr features in a real-world sample (CRUD on Wine cellar, file transfers, auth flows).
• Two client branches show before/after using Apizr.
• Underlying architecture: MAUI client ⇄ Apizr/ReFit HTTP client ⇄ .NET Web API ⇄ EF Core SQL database.
Diagramming the Architecture
a. Main Components
• Mobile Clients (MAUI apps)
– View Layer (XAML Pages)
– ViewModels (MVVM)
– Apizr/ReFit HTTP Client layer (With.Apizr) or direct Refit/HttpClient (Without.Apizr)
– Navigation Service
• StarCellar Web API
– Handlers/Controllers (Users, Wines, Files)
– Business Utilities (TokenGenerator, Validators, Converters)
– Data Access (EF Core DbContext)
• Data Store
– SQL Server (or SQLite) database with tables for Users, Wines, RefreshTokens
• External Services (optional)
– Email provider (for validation), Identity Provider if extended
b. Relationships & Interactions
1. User interacts with the MAUI UI → invokes commands on ViewModel.
2. ViewModel calls Apizr client → issues HTTP requests to API endpoints.
3. API Handlers process requests → use Utils + DbContext to read/write to database.
4. Database returns entities → API serializes DTOs back to client.
5. Apizr layer handles retries, caching, connectivity checks, authentication (JWT + refresh tokens).
c. Architectural Patterns & Principles
– MVVM on the client
– Refit + Apizr as a layer to encapsulate HTTP concerns (resilience, logging, auth)
– Clean separation: API controllers vs Data vs Utils
– Dependency Injection throughout (MauiProgram.cs and Program.cs in API)
d. Key Technologies
– .NET MAUI, XAML (cross-platform UI)
– MVVM pattern (ViewModels, NavigationService)
– Apizr/Refit (client HTTP abstraction)
– .NET 6 Web API, minimal Program.cs
– EF Core Code-First migrations
– JWT Bearer Authentication, Refresh Tokens
Detail
• Every layer: UI → MVVM → HTTP client → API layers → data access → persistence.
• This clarity helps guide both tutorial readers and maintainers through the end-to-end flow.