How lucasayb/pkmds-blazor works
Project Type & Purpose
• PKMDS is a Progressive Web App (PWA) built on Blazor WebAssembly.
• It runs entirely in the browser (no custom backend), loading .NET DLLs (including PKHeX.Core) into a WebAssembly runtime to parse and edit Pokémon save files.
• It supports offline use via a Service Worker.
File Structure
• Top-level “Pkmds.Web” directory contains:
• Components/ (UI razor components)
• Services/ (C# classes for file parsing, state, JS interop)
• wwwroot/ (static assets, service-worker.js, sprites, CSS, JS libs)
• Program.cs & App.razor (app startup)
• Config files: launchSettings.json, libman.json, Service Worker manifests, _Imports.razor
• No “backend” directory: this is a purely client-side app.
Technical Stack from README
• Blazor WebAssembly (.NET 7+), PKHeX.Core (.NET library for save‐file I/O)
• PWA features: service‐worker.js, manifest.webmanifest
• JS interop for file download (fileSave.js) and crypto (crypto-js)
• Hosted on GitHub Pages, initial fetch from static HTTP server, then offline.
Main Components & Interactions
a. Browser & PWA Layer
• User’s browser (Chrome/Chromium)
• Service Worker: caches HTML, CSS, JS, .NET DLLs, sprites, manifest
• Offline cache ensures repeat loads from local
b. Blazor WebAssembly Runtime
• Bootstraps .NET runtime in WebAssembly
• Loads Pkmds.Web.dll + dependencies (PKHeX.Core.dll)
c. UI Layer (Components)
• Razor components (FileUploadDialog, PokemonEditForm, BoxGrid, etc.)
• Data-bound to an application state (AppState.cs / IAppState)
d. Application Logic & Services
• AppService: orchestrates reading/parsing save‐file bytes via PKHeX.Core
• RefreshService: notifies UI of data changes
• JsService: JS Interop for calling fileSave.js & Crypto-JS functions (AES, MD5)
e. PKHeX.Core Library
• .NET library loaded into Wasm to read/write various save formats
f. Browser APIs & External Libraries
• IndexedDB or in‐memory store (if used)
• FileSaver API (via fileSave.js)
• crypto-js for cryptographic helpers (if needed by PKHeX.Core)
g. Assets & Static Content
• Sprites (wwwroot/sprites/…)
• CSS (app.css)
Architectural Patterns & Design Principles
• Component-Based UI (Blazor Razor components)
• Service Abstraction (IAppService, IRefreshService, JsService interfaces)
• Single-Page Application with PWA caching
• Separation of concerns: UI vs. file I/O vs. state management vs. JS interop
• Clear labels: “Browser”, “Service Worker (Cache)”, “Blazor Wasm Runtime”, “Pkmds.Web.dll”, “PKHeX.Core.dll”, “JsService”, etc.