Files
RpgRoller/README.md

103 lines
3.8 KiB
Markdown

# RpgRoller
Fresh full-stack starter scaffold:
- `RpgRoller/`: ASP.NET Core backend + Blazor frontend host (`Components` + `wwwroot`)
- `RpgRoller.Tests/`: xUnit integration-heavy test project
- `RpgRoller.sln`: solution used by local CI script
- `UX.md`: frontend UX and interaction design specification (pre-implementation baseline)
- `FRONTEND_PROGRESS.md`: implementation tracking (`Implemented` / `Partially implemented` / `Not yet implemented`)
Test layout:
- `RpgRoller.Tests/Api/`: API integration tests grouped by feature concern
- `RpgRoller.Tests/Services/`: service-level tests grouped by domain concern
- `RpgRoller.Tests/Support/`: shared test harnesses/builders/helpers
## Code Organization
Backend:
- `RpgRoller/Program.cs`: thin app bootstrap only
- `RpgRoller/Hosting/`: service registration + startup initialization
- `RpgRoller/Api/`: endpoint mapping modules and auth/session filter helpers
- `RpgRoller/Services/`: game workflows with explicit method parameters (no API DTO dependencies)
Frontend:
- `RpgRoller/Components/`: Blazor root app, routes, layout and page components
- `RpgRoller/Components/Pages/Home.razor(.cs)`: main UX implementation for auth/play/management screens
- `RpgRoller/wwwroot/js/rpgroller-api.js`: browser-side API + SSE + session storage interop for Blazor
- `RpgRoller/wwwroot/styles.css`: responsive UX styling and theme tokens
Backend state persistence:
- EF Core with SQLite (`Microsoft.EntityFrameworkCore.Sqlite`)
- Development DB: `RpgRoller/App_Data/rpgroller.development.db`
- Default DB: `RpgRoller/App_Data/rpgroller.db`
- Database schema is created automatically on startup (`EnsureCreated`)
- Runtime state is loaded once at startup into memory and written back to SQLite on successful state changes
## Prerequisites
- .NET SDK 10.0+
- PowerShell 7+
## Local Development
1. Run the local CI parity script:
```powershell
pwsh ./scripts/ci-local.ps1
```
2. Start the backend:
```powershell
dotnet run --project RpgRoller/RpgRoller.csproj
```
3. Open `http://localhost:5000` (or the port shown in the console).
To use a custom SQLite database path, set `ConnectionStrings__RpgRoller`.
## Frontend Runtime
- Runtime frontend is Blazor Server with interactive components.
- Browser interop is in `RpgRoller/wwwroot/js/rpgroller-api.js`.
- OpenAPI contract source remains at `openapi/RpgRoller.json`.
## Test and Coverage
- Tests:
```powershell
dotnet test RpgRoller.Tests/RpgRoller.Tests.csproj --collect:"XPlat Code Coverage" --settings RpgRoller.Tests/coverlet.runsettings
```
- Coverage gate:
```powershell
pwsh ./scripts/check-coverage.ps1 -MinLineRate 0.90 -MinBranchRate 0.70
```
- Coverage collector scope:
- `RpgRoller.Tests/coverlet.runsettings` now measures the full backend assembly (`RpgRoller`), not only service namespace files.
## Implemented Backend Scope
- Auth: register, login, logout, current user context
- Session cookie: `HttpOnly`, `SameSite=Strict`, `Secure` when served over HTTPS
- Rulesets: d6 and dnd5e validation rules
- Campaigns: create/list/read
- Characters: create/update/activate/current-campaign list
- Skills: create/update with ruleset-aware dice expression validation
- Rolls: public/private skill rolls with append-only campaign log
- State stream: SSE endpoint for campaign version updates
## Implemented Frontend Scope
- Blazor-driven UI for:
- registration, login, logout
- play screen and campaign management screen switch
- campaign creation and selection
- character create/edit/activate via modal forms
- skill create/edit via modal forms
- public/private rolling and campaign log viewing
- responsive play UX:
- desktop two-column (character + log)
- tablet/mobile panel switching with bottom tab bar (`Character` / `Log`)
- SSE-backed live refresh with reconnect status + manual refresh fallback