Document SQLite persistence and local reset behavior

This commit is contained in:
2026-02-24 22:48:32 +01:00
parent 3c6dc5c0a9
commit f212636feb
3 changed files with 22 additions and 3 deletions

9
FAQ.md
View File

@@ -14,3 +14,12 @@ This keeps the first commit small while preserving CI discipline. Additional too
## Is frontend JavaScript handwritten? ## Is frontend JavaScript handwritten?
No. Frontend source code lives in `RpgRoller/frontend/*.ts` and is compiled to `RpgRoller/wwwroot/*.js` for browser delivery. No. Frontend source code lives in `RpgRoller/frontend/*.ts` and is compiled to `RpgRoller/wwwroot/*.js` for browser delivery.
## Where is backend state stored locally?
Backend state is persisted via EF Core + SQLite.
- Development default: `RpgRoller/App_Data/rpgroller.development.db`
- Non-development default: `RpgRoller/App_Data/rpgroller.db`
To start with a clean backend state, stop the app and remove the corresponding SQLite file.

View File

@@ -7,6 +7,13 @@ Fresh full-stack starter scaffold:
- `RpgRoller.Tests/`: xUnit integration-heavy test project - `RpgRoller.Tests/`: xUnit integration-heavy test project
- `RpgRoller.sln`: solution used by local CI script - `RpgRoller.sln`: solution used by local CI script
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`)
## Prerequisites ## Prerequisites
- .NET SDK 10.0+ - .NET SDK 10.0+
@@ -25,6 +32,8 @@ Fresh full-stack starter scaffold:
``` ```
3. Open `http://localhost:5000` (or the port shown in the console). 3. Open `http://localhost:5000` (or the port shown in the console).
To use a custom SQLite database path, set `ConnectionStrings__RpgRoller`.
## Frontend Tooling ## Frontend Tooling
- OpenAPI contract: `openapi/RpgRoller.json` - OpenAPI contract: `openapi/RpgRoller.json`

View File

@@ -6,6 +6,7 @@
- Backend/full-stack project: `RpgRoller` (Minimal API + static `wwwroot` frontend) - Backend/full-stack project: `RpgRoller` (Minimal API + static `wwwroot` frontend)
- Frontend source: `RpgRoller/frontend` (TypeScript) - Frontend source: `RpgRoller/frontend` (TypeScript)
- Test project: `RpgRoller.Tests` (xUnit + `WebApplicationFactory` integration tests) - Test project: `RpgRoller.Tests` (xUnit + `WebApplicationFactory` integration tests)
- Persistence: EF Core + SQLite (`RpgRoller/Data/RpgRollerDbContext.cs`)
- OpenAPI source: `openapi/RpgRoller.json` - OpenAPI source: `openapi/RpgRoller.json`
- Generated client source: `RpgRoller/frontend/generated/api-client.ts` - Generated client source: `RpgRoller/frontend/generated/api-client.ts`
- Generated client output: `RpgRoller/wwwroot/generated/api-client.js` - Generated client output: `RpgRoller/wwwroot/generated/api-client.js`
@@ -16,11 +17,11 @@
## 1) Stack and baseline choices ## 1) Stack and baseline choices
- ASP.NET Core Minimal API on .NET 10. - ASP.NET Core Minimal API on .NET 10.
- EF Core + Database in current project (single-node deployment). - EF Core with SQLite file persistence in current project (single-node deployment).
- Cookie authentication (`HttpOnly`, `SameSite=Strict`, secure in production). - Cookie authentication (`HttpOnly`, `SameSite=Strict`, secure in production).
- A minimal frontend framework supporting mixing 3D graphics with 2D elements, or a modern framework-less alternative (HTMl/CSS/TypeScript). - A minimal frontend framework supporting mixing 3D graphics with 2D elements, or a modern framework-less alternative (HTMl/CSS/TypeScript).
- OpenAPI generated from backend and consumed by generated client. - OpenAPI generated from backend and consumed by generated client.
- xUnit integration-heavy test suite with in-memory Database and coverage gates. - xUnit integration-heavy test suite with isolated SQLite test databases and coverage gates.
## 2) Architecture patterns to keep ## 2) Architecture patterns to keep
@@ -78,7 +79,7 @@ This pattern is a strong baseline for low to medium scale and should be the defa
### 2.5 Data and invariants ### 2.5 Data and invariants
- Strong DB models - Strong DB models backed by SQLite
- DB-level guardrails (trigger) to complement app-level checks - DB-level guardrails (trigger) to complement app-level checks
- EF patterns: - EF patterns:
- `AsNoTracking()` for read-only queries - `AsNoTracking()` for read-only queries