To run this application:
- run dotnet workload install aspire
- ensure you have Docker running
- set the start-up project to be the AppHost project.
This will launch all the needed projects and launch the .NET Aspire dashboard.
The application follows clean architecture principles with explicit domain services and DTO boundaries:
- IWordProvider: Provides target words from database or in-memory sources
DatabaseWordProvider
: Fetches words from SQL Server databaseInMemoryWordProvider
: Fallback provider for testing/development
- IGuessEvaluator: Pure function for evaluating guesses against target words
GuessEvaluator
: Implements Wordle logic for letter status evaluation
- IGameService: Orchestrates game sessions and high-level operations
GameService
: Manages session lifecycle and guess processing
- Domain Models:
GameSession
: Aggregate containing game state, attempts, and completion statusGuessResult
&LetterResult
: Value objects for guess evaluation results
- Clean DTOs: All public endpoints return DTOs, no domain object leakage
GameSessionDto
: Game state for API responsesGuessResultDto
&LetterResultDto
: Guess evaluation results
- RESTful Endpoints:
GET /codele-words
: Get available words from databasePOST /game/create
: Create new game sessionPOST /game/guess
: Submit guess with validationGET /game/{gameId}
: Get current game state
- Error Handling: Proper HTTP status codes and ProblemDetails responses
- Typed API Client:
CodeleApiClient
consumes DTOs only - Clean Component State:
PlayCodele.razor
works with DTOs, no direct domain dependencies - Error Handling: Graceful handling of API failures with user feedback
This architecture enables:
- Easy testing of isolated business logic
- Future rule variants without UI/API changes
- Clear API evolution without breaking contracts
- Database-backed word list with fallback options
This branch includes a few small improvements for developer experience and observability:
-
Health endpoints
/healthz
- liveness probe (returns 200 when the process is up)/readyz
- readiness probe (verifies SQL Server connectivity ifConnectionStrings:codele
is configured and Redis ping ifRedis:ConnectionString
is provided). Returns 200 with JSON details when healthy or 503 when a dependency is unhealthy.
-
Typed HttpClient for the Web project
CodeleApiClient
is registered as a typed HttpClient and configured with a simple retry policy to improve resilience against transient 5xx responses.
Example: configure the Web project to talk to the ApiService (service discovery is used by Aspire):
{
"Services": {
"ApiBaseUrl": "https+http://apiservice"
}
}
Then the CodeleApiClient
can be injected into Blazor components and called as an async typed client.
If you want these quick wins adjusted (different retry policy, additional checks in /readyz
, or documentation tweaks), open an issue or request a follow-up PR.