From 1d512d321b575b18e9392160dbce0b591a75df35 Mon Sep 17 00:00:00 2001 From: Frank Tovar Date: Tue, 24 Feb 2026 23:13:25 +0100 Subject: [PATCH] Document startup hydration and write-through persistence --- FAQ.md | 4 ++++ README.md | 1 + TECH.md | 3 ++- 3 files changed, 7 insertions(+), 1 deletion(-) diff --git a/FAQ.md b/FAQ.md index 5c5064d..5db3ddf 100644 --- a/FAQ.md +++ b/FAQ.md @@ -23,3 +23,7 @@ Backend state is persisted via EF Core + SQLite. - Non-development default: `RpgRoller/App_Data/rpgroller.db` To start with a clean backend state, stop the app and remove the corresponding SQLite file. + +## Does the backend read SQLite on every API call? + +No. The backend loads state from SQLite once during startup into in-memory state and serves requests from memory. Successful state mutations are then written back to SQLite. diff --git a/README.md b/README.md index 0771dfb..cf247b0 100644 --- a/README.md +++ b/README.md @@ -13,6 +13,7 @@ Backend state persistence: - 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 diff --git a/TECH.md b/TECH.md index 6d0fc87..523b5aa 100644 --- a/TECH.md +++ b/TECH.md @@ -6,7 +6,7 @@ - Backend/full-stack project: `RpgRoller` (Minimal API + static `wwwroot` frontend) - Frontend source: `RpgRoller/frontend` (TypeScript) - Test project: `RpgRoller.Tests` (xUnit + `WebApplicationFactory` integration tests) -- Persistence: EF Core + SQLite (`RpgRoller/Data/RpgRollerDbContext.cs`) +- Persistence: EF Core + SQLite (`RpgRoller/Data/RpgRollerDbContext.cs`) with in-memory runtime cache in `GameService` - OpenAPI source: `openapi/RpgRoller.json` - Generated client source: `RpgRoller/frontend/generated/api-client.ts` - Generated client output: `RpgRoller/wwwroot/generated/api-client.js` @@ -18,6 +18,7 @@ - ASP.NET Core Minimal API on .NET 10. - EF Core with SQLite file persistence in current project (single-node deployment). +- Game state is hydrated once on startup and then served from in-memory state; writes are persisted back to SQLite after successful mutations. - 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). - OpenAPI generated from backend and consumed by generated client.