Pruvodce pro vyvojare pracujici na projektu LexiQuest.
LexiQuest je webova hra pro uceni slovicek. Uzivatele se uci nova slova formou interaktivnich hernich kol, sbiranim XP, postupem v ligach a soutezenich s ostatnimi hraci v realnem case. Aplikace podporuje premium predplatne, vlastni slovniky, boss levely, tymy a dalsich pokrocile funkce.
| Kategorie | Technologie |
|---|---|
| Backend | .NET 10, ASP.NET Core Web API |
| Frontend | Blazor WebAssembly |
| Databaze | SQL Server (EF Core) |
| Realtime komunikace | SignalR (WebSockets) |
| Platby | Stripe (predplatne, jednorazy) |
| UI komponenty | Tempo.Blazor |
| Validace | FluentValidation |
| Logování | Serilog (Console + File sink) |
| Autentizace | JWT Bearer tokens |
| Lokalizace | .resx resource soubory |
| Testy | xUnit, bUnit, FluentAssertions, NSubstitute |
| Cache | In-Memory cache (MemoryCache) |
- .NET 10 SDK
- SQL Server (LocalDB, Express nebo plna verze)
- Docker (povinny pro E2E testy s Testcontainers)
- Node.js 18+ (pouze pro Playwright E2E testy)
- IDE: Visual Studio 2025, VS Code nebo Rider
git clone https://github.com/your-org/lexiquest.git
cd lexiquestdotnet restoreUpravte src/LexiQuest.Api/appsettings.Development.json:
{
"ConnectionStrings": {
"DefaultConnection": "Server=(localdb)\\mssqllocaldb;Database=LexiQuest;Trusted_Connection=True;MultipleActiveResultSets=true;TrustServerCertificate=True"
},
"JwtSettings": {
"SecretKey": "VaseTajneHesloProVyvojMinimalne64ZnakuDlouheAbySplnovaloPozadavkyHS256"
}
}Poznamka: Soubor
appsettings.Development.jsonje v.gitignorea musi byt vytvoren lokalne.
dotnet ef database update \
--project src/LexiQuest.Infrastructure \
--startup-project src/LexiQuest.Apidotnet run --project src/LexiQuest.ApiAPI bude dostupne na https://localhost:5000. Swagger UI: https://localhost:5000/swagger
V novem terminalu:
dotnet run --project src/LexiQuest.BlazorFrontend bude dostupny na https://localhost:5001.
dotnet testdotnet test --filter "Category!=Integration"dotnet test --filter "Category=Integration"dotnet test tests/LexiQuest.Core.Tests
dotnet test tests/LexiQuest.Api.Tests
dotnet test tests/LexiQuest.Blazor.Tests
dotnet test tests/LexiQuest.Infrastructure.TestsE2E sada spousti automaticky SQL Server Testcontainer, smtp4dev Testcontainer, API proces a Web proces. Nepouziva lokalni vyvojovou databazi ani realny SMTP server.
Pred prvnim spustenim nainstalujte Playwright browser:
dotnet build tests/LexiQuest.E2E.Tests/LexiQuest.E2E.Tests.csproj
pwsh tests/LexiQuest.E2E.Tests/bin/Debug/net10.0/playwright.ps1 install --with-deps chromiumZakladni prikazy:
# Rychla sada pro PR/smoke overeni
dotnet test tests/LexiQuest.E2E.Tests/LexiQuest.E2E.Tests.csproj --filter "Category=Smoke"
# Plna aktualni E2E sada
dotnet test tests/LexiQuest.E2E.Tests/LexiQuest.E2E.Tests.csproj --filter "Category=Full"
# Screenshot/UX scenare
dotnet test tests/LexiQuest.E2E.Tests/LexiQuest.E2E.Tests.csproj --filter "Category=Visual"
# Emailove scenare pres smtp4dev
dotnet test tests/LexiQuest.E2E.Tests/LexiQuest.E2E.Tests.csproj --filter "Category=Email"Debug promene:
E2E_HEADLESS=false
E2E_TRACE=on
E2E_SLOWMO_MS=100Artefakty se ukladaji do artifacts/e2e/: screenshoty, metadata, videa, trace zipy a logy API/Web/containeru pri padu testu.
dotnet test --verbosity normal --logger "console;verbosity=detailed"LexiQuest/
├── src/
│ ├── LexiQuest.Api/ # ASP.NET Core Web API
│ │ ├── Controllers/ # REST API controllery
│ │ ├── Endpoints/ # Minimal API endpointy
│ │ ├── Hubs/ # SignalR huby (MatchHub)
│ │ ├── Validators/ # Request validatory
│ │ └── Resources/ # Lokalizacni soubory API
│ │
│ ├── LexiQuest.Blazor/ # Blazor WebAssembly frontend
│ │ ├── Pages/ # Stranky (routovatelne komponenty)
│ │ ├── Components/ # Znovupouzitelne komponenty
│ │ ├── Layout/ # Layout komponenty
│ │ ├── Services/ # Frontend sluzby (HTTP klienti)
│ │ ├── Resources/ # Lokalizacni soubory
│ │ └── wwwroot/ # Staticke soubory (CSS, JS, images)
│ │
│ ├── LexiQuest.Core/ # Domenova vrstva (jadro aplikace)
│ │ ├── Domain/
│ │ │ ├── Entities/ # Domenove entity
│ │ │ ├── Enums/ # Vycty
│ │ │ └── ValueObjects/ # Value objekty
│ │ ├── Interfaces/
│ │ │ ├── Repositories/ # Repository rozhrani
│ │ │ └── Services/ # Service rozhrani
│ │ ├── Services/ # Domenove sluzby (implementace)
│ │ ├── Validators/ # Domenove validatory
│ │ └── Jobs/ # Background joby
│ │
│ ├── LexiQuest.Infrastructure/ # Infrastrukturni vrstva
│ │ ├── Persistence/
│ │ │ ├── Configurations/ # EF Core entity konfigurace
│ │ │ └── Repositories/ # Repository implementace
│ │ ├── Auth/ # JWT token service
│ │ ├── Services/ # Externi sluzby (Stripe, Email)
│ │ └── Caching/ # Cache implementace
│ │
│ └── LexiQuest.Shared/ # Sdilene typy
│ ├── DTOs/ # Data Transfer Objects
│ ├── Enums/ # Sdilene vycty
│ └── Resources/ # Sdilene lokalizacni soubory
│
├── tests/
│ ├── LexiQuest.Core.Tests/ # Unit testy domeny
│ ├── LexiQuest.Api.Tests/ # API integracni testy
│ ├── LexiQuest.Blazor.Tests/ # bUnit testy komponent
│ └── LexiQuest.Infrastructure.Tests/ # Infrastrukturni testy
│
├── docs/ # Dokumentace
│ ├── uc/ # Use case specifikace
│ ├── ui-ux/ # UI/UX specifikace
│ ├── architecture/ # Architektura
│ └── deployment/ # Nasazeni a troubleshooting
│
└── todo/ # Implementacni plan a sledovani pokroku
Projekt sleduje principy Clean Architecture:
Core (bez zavislosti)
↑
Infrastructure (zavisi na Core)
↑
Api / Blazor (zavisi na Infrastructure a Core)
- Core nesmi referencovat zadny jiny projekt
- Infrastructure referencuje pouze Core
- Api referencuje Core, Infrastructure a Shared
- Blazor referencuje pouze Shared
- Shared je bez zavislosti (DTOs, enums)
Vsechny domenove entity pouzivaji nasledujici vzor:
public class Entity
{
// Privatni konstruktor - EF Core
private Entity() { }
// Staticka tovarni metoda
public static Entity Create(string param1, int param2)
{
// Validace vstupu
// Inicializace properties
return new Entity { ... };
}
// Privatni settery
public Guid Id { get; private set; }
public string Name { get; private set; } = string.Empty;
// Domenove metody pro zmenu stavu
public void UpdateName(string newName) { ... }
}Vsechny vstupy od uzivatele musi byt validovany pomoci FluentValidation:
public class CreateEntityValidator : AbstractValidator<CreateEntityRequest>
{
public CreateEntityValidator(IStringLocalizer<CreateEntityValidator> localizer)
{
RuleFor(x => x.Name)
.NotEmpty().WithMessage(localizer["NameRequired"])
.MaximumLength(100).WithMessage(localizer["NameTooLong"]);
}
}- Zadne hardcoded retezce v UI ani v chybovych hlasenich
- Vsechny texty v
.resxsouborech - Struktura:
Resources/Pages/NazevStranky.resx,Resources/Components/NazevKomponenty.resx - Pouziti v komponentach:
@inject IStringLocalizer<NazevKomponenty> L <h1>@L["Nadpis"]</h1>
Kazda Blazor komponenta s vlastnimi styly pouziva scoped CSS:
Components/
MyComponent.razor
MyComponent.razor.css # Scoped styly
Doporuceny pracovni postup:
- Napsat test (cerveny)
- Napsat minimalni implementaci (zeleny)
- Refaktorovat
- Opakovat
| Controller | Zakladni cesta | Popis |
|---|---|---|
UsersController |
/api/users |
Registrace, prihlaseni, profil |
DictionaryController |
/api/dictionaries |
Vlastni slovniky |
AchievementsController |
/api/achievements |
Achievementy |
DailyChallengeController |
/api/daily-challenge |
Denni vyzvy |
LeaguesController |
/api/leagues |
Ligy a zebrickky |
MultiplayerController |
/api/multiplayer |
Multiplayer funkce |
PremiumController |
/api/premium |
Premium predplatne |
ShopController |
/api/shop |
Obchod s predmety |
StreakProtectionController |
/api/streak-protection |
Streak shield/freeze |
TeamsController |
/api/teams |
Tymy a klany |
WebhookController |
/api/webhook |
Stripe webhooky |
NotificationsController |
/api/notifications |
Push notifikace |
AdminWordsController |
/api/admin/words |
Administrace slov |
AdminUsersController |
/api/admin/users |
Administrace uzivatelu |
AIChallengeController |
/api/ai-challenge |
AI generovane vyzvy |
| Soubor | Cesta | Popis |
|---|---|---|
GameEndpoints |
/api/game/* |
Herni smycka |
UserEndpoints |
/api/users/* |
Doplnkove user endpointy |
GuestEndpoints |
/api/guest/* |
Testovaci hra bez registrace |
| Hub | Cesta | Popis |
|---|---|---|
MatchHub |
/hubs/match |
Realtime multiplayer |
Swagger je dostupny v Development rezimu na: https://localhost:5000/swagger
feature/nazev-funkce- nova funkcionalitafix/popis-opravy- oprava chybydocs/popis- dokumentacerefactor/popis- refaktoring bez zmeny funkcionalitytest/popis- doplneni testu
Kazdy PR musi obsahovat:
- Popis - co se meni a proc
- Test plan - jak otestovat zmeny
- Vsechny testy musi prochazet - CI pipeline bezi automaticky
Na kazdem PR se automaticky spusti:
dotnet restoredotnet build --no-restoredotnet test --no-build
# Build celeho solution
dotnet build
# Spusteni API s hot reload
dotnet watch --project src/LexiQuest.Api
# Pridani nove EF Core migrace
dotnet ef migrations add NazevMigrace \
--project src/LexiQuest.Infrastructure \
--startup-project src/LexiQuest.Api
# Smazani posledni migrace (pokud neni aplikovana)
dotnet ef migrations remove \
--project src/LexiQuest.Infrastructure \
--startup-project src/LexiQuest.Api
# Generovani SQL scriptu
dotnet ef migrations script \
--project src/LexiQuest.Infrastructure \
--startup-project src/LexiQuest.Api \
--idempotent
# Cisteni build artefaktu
dotnet clean
# Aktualizace NuGet balicku
dotnet outdated # vyzaduje dotnet-outdated tool