## Project Overview and Architecture A concise high-level view of how the solution projects fit together, their runtime hosts (server, WASM client, MAUI) and how cross-cutting concerns are wired via dependency injection, mapping and real-time services. Diagrams below show dependencies, startup/service registration, Program.cs control and method-level flows. === DIAGRAM 1: Dependency and Model Map (dependency-map) === ```mermaid --- config: flowchart: defaultRenderer: "elk" --- flowchart TD flow_file_nexusreader_application_abstractions_services_ibillingservice_cs_file_1["IBillingService"] flow_file_nexusreader_application_abstractions_services_ibookstorageservice_cs_file_1["IBookStorageService"] flow_file_nexusreader_application_abstractions_services_iidentityservice_cs_file_1["IIdentityService"] flow_file_nexusreader_application_abstractions_services_iknowledgeservice_cs_file_1["IKnowledgeService"] flow_file_nexusreader_application_abstractions_messaging_icommand_cs_file_1["ICommand.cs"] flow_file_nexusreader_application_abstractions_messaging_icommandhandler_cs_file_1["ICommandHandler"] flow_file_nexusreader_application_abstractions_messaging_iquery_cs_file_1["IQuery.cs"] flow_file_nexusreader_application_abstractions_messaging_iqueryhandler_cs_file_1["IQueryHandler"] flow_file_nexusreader_application_abstractions_persistence_iebookrepository_cs_file_1["IEbookRepository"] flow_file_nexusreader_infrastructure_identity_tokenlimithandler_cs_file_1["TokenLimitHandler"] flow_type_nexusreader_application_abstractions_messaging_icommand_cs_icommand_6[/"ICommand"/] flow_type_nexusreader_application_abstractions_messaging_icommand_cs_icommand_tresponse_10[/"ICommand"/] flow_type_nexusreader_application_abstractions_messaging_icommandhandler_cs_icommandhandler_tcommand_6[/"ICommandHandler"/] flow_type_nexusreader_application_abstractions_messaging_icommandhandler_cs_icommandhandler_tcommand_tresponse_11[/"ICommandHandler"/] flow_type_nexusreader_application_abstractions_messaging_iquery_cs_iquery_tresponse_6[/"IQuery"/] flow_type_nexusreader_application_abstractions_messaging_iqueryhandler_cs_iqueryhandler_6[/"IQueryHandler"/] flow_type_nexusreader_application_abstractions_persistence_iebookrepository_cs_iebookrepository_9[/"IEbookRepository"/] flow_type_nexusreader_application_abstractions_services_ibillingservice_cs_ibillingservice_6[/"IBillingService"/] flow_type_nexusreader_application_abstractions_services_ibookstorageservice_cs_ibookstorageservice_6[/"IBookStorageService"/] flow_type_nexusreader_application_abstractions_services_iidentityservice_cs_iidentityservice_6[/"IIdentityService"/] flow_file_nexusreader_application_abstractions_messaging_icommand_cs_file_1 -->|interface ICommand| flow_type_nexusreader_application_abstractions_messaging_icommand_cs_icommand_6 flow_file_nexusreader_application_abstractions_messaging_icommand_cs_file_1 -->|interface ICommand TResponse>| flow_type_nexusreader_application_abstractions_messaging_icommand_cs_icommand_tresponse_10 flow_file_nexusreader_application_abstractions_messaging_icommandhandler_cs_file_1 -->|interface ICommandHandler TCommand>| flow_type_nexusreader_application_abstractions_messaging_icommandhandler_cs_icommandhandler_tcommand_6 flow_file_nexusreader_application_abstractions_messaging_icommandhandler_cs_file_1 -->|interface ICommandHandler TCommand, TResponse>| flow_type_nexusreader_application_abstractions_messaging_icommandhandler_cs_icommandhandler_tcommand_tresponse_11 flow_file_nexusreader_application_abstractions_messaging_iquery_cs_file_1 -->|interface IQuery TResponse>| flow_type_nexusreader_application_abstractions_messaging_iquery_cs_iquery_tresponse_6 flow_file_nexusreader_application_abstractions_messaging_iqueryhandler_cs_file_1 -->|interface IQueryHandler| flow_type_nexusreader_application_abstractions_messaging_iqueryhandler_cs_iqueryhandler_6 flow_file_nexusreader_application_abstractions_persistence_iebookrepository_cs_file_1 -->|interface IEbookRepository| flow_type_nexusreader_application_abstractions_persistence_iebookrepository_cs_iebookrepository_9 flow_file_nexusreader_application_abstractions_services_ibillingservice_cs_file_1 -->|interface IBillingService| flow_type_nexusreader_application_abstractions_services_ibillingservice_cs_ibillingservice_6 flow_file_nexusreader_application_abstractions_services_ibookstorageservice_cs_file_1 -->|interface IBookStorageService| flow_type_nexusreader_application_abstractions_services_ibookstorageservice_cs_ibookstorageservice_6 flow_file_nexusreader_application_abstractions_services_iidentityservice_cs_file_1 -->|interface IIdentityService| flow_type_nexusreader_application_abstractions_services_iidentityservice_cs_iidentityservice_6 flow_file_nexusreader_application_abstractions_services_iknowledgeservice_cs_file_1 -->|interface IKnowledgeService| flow_type_nexusreader_application_abstractions_services_iknowledgeservice_cs_iknowledge_6 click flow_file_nexusreader_application_abstractions_messaging_iquery_cs_file_1 href "vscode://file/NexusReader.Application/Abstractions/Messaging/IQuery.cs:1:1" "Open source" click flow_type_nexusreader_application_abstractions_messaging_iquery_cs_iquery_tresponse_6 href "vscode://file/NexusReader.Application/Abstractions/Messaging/IQuery.cs:6:1" "Open source" click flow_file_nexusreader_application_abstractions_messaging_icommand_cs_file_1 href "vscode://file/NexusReader.Application/Abstractions/Messaging/ICommand.cs:1:1" "Open source" click flow_type_nexusreader_application_abstractions_messaging_icommand_cs_icommand_6 href "vscode://file/NexusReader.Application/Abstractions/Messaging/ICommand.cs:6:1" "Open source" click flow_type_nexusreader_application_abstractions_messaging_icommand_cs_icommand_tresponse_10 href "vscode://file/NexusReader.Application/Abstractions/Messaging/ICommand.cs:10:1" "Open source" click flow_file_nexusreader_application_abstractions_messaging_icommandhandler_cs_file_1 href "vscode://file/NexusReader.Application/Abstractions/Messaging/ICommandHandler.cs:1:1" "Open source" click flow_type_nexusreader_application_abstractions_messaging_icommandhandler_cs_icommandhandler_tcommand_6 href "vscode://file/NexusReader.Application/Abstractions/Messaging/ICommandHandler.cs:6:1" "Open source" click flow_type_nexusreader_application_abstractions_messaging_icommandhandler_cs_icommandhandler_tcommand_tresponse_11 href "vscode://file/NexusReader.Application/Abstractions/Messaging/ICommandHandler.cs:11:1" "Open source" click flow_file_nexusreader_application_abstractions_messaging_iqueryhandler_cs_file_1 href "vscode://file/NexusReader.Application/Abstractions/Messaging/IQueryHandler.cs:1:1" "Open source" click flow_type_nexusreader_application_abstractions_messaging_iqueryhandler_cs_iqueryhandler_6 href "vscode://file/NexusReader.Application/Abstractions/Messaging/IQueryHandler.cs:6:1" "Open source" click flow_file_nexusreader_infrastructure_identity_tokenlimithandler_cs_file_1 href "vscode://file/NexusReader.Infrastructure/Identity/TokenLimitHandler.cs:1:1" "Open source" click flow_file_nexusreader_application_abstractions_services_ibillingservice_cs_file_1 href "vscode://file/NexusReader.Application/Abstractions/Services/IBillingService.cs:1:1" "Open source" click flow_type_nexusreader_application_abstractions_services_ibillingservice_cs_ibillingservice_6 href "vscode://file/NexusReader.Application/Abstractions/Services/IBillingService.cs:6:1" "Open source" click flow_file_nexusreader_application_abstractions_persistence_iebookrepository_cs_file_1 href "vscode://file/NexusReader.Application/Abstractions/Persistence/IEbookRepository.cs:1:1" "Open source" click flow_type_nexusreader_application_abstractions_persistence_iebookrepository_cs_iebookrepository_9 href "vscode://file/NexusReader.Application/Abstractions/Persistence/IEbookRepository.cs:9:1" "Open source" click flow_file_nexusreader_application_abstractions_services_ibookstorageservice_cs_file_1 href "vscode://file/NexusReader.Application/Abstractions/Services/IBookStorageService.cs:1:1" "Open source" click flow_type_nexusreader_application_abstractions_services_ibookstorageservice_cs_ibookstorageservice_6 href "vscode://file/NexusReader.Application/Abstractions/Services/IBookStorageService.cs:6:1" "Open source" click flow_file_nexusreader_application_abstractions_services_iidentityservice_cs_file_1 href "vscode://file/NexusReader.Application/Abstractions/Services/IIdentityService.cs:1:1" "Open source" click flow_type_nexusreader_application_abstractions_services_iidentityservice_cs_iidentityservice_6 href "vscode://file/NexusReader.Application/Abstractions/Services/IIdentityService.cs:6:1" "Open source" click flow_file_nexusreader_application_abstractions_services_iknowledgeservice_cs_file_1 href "vscode://file/NexusReader.Application/Abstractions/Services/IKnowledgeService.cs:1:1" "Open source" ``` This diagram maps core application interfaces (commands, queries, services, repositories) and shows where infrastructure handlers (e.g., TokenLimitHandler) connect. It highlights ownership: Application contains abstractions, Infrastructure implements runtime concerns. === DIAGRAM 2: Startup and Service Registration Flow (primary-runtime) === ```mermaid --- config: flowchart: defaultRenderer: "elk" --- flowchart TD subgraph flow_1_nexusreader_web_client_program_cs["Program.cs"] end flow_file_nexusreader_web_client_program_cs_file_1["Program.cs"] flow_method_nexusreader_web_client_nexusreader_web_client_csproj_project_configuration_1["project-configuration"] flow_method_nexusreader_web_client_program_cs_run_wasm_host_59["Run WASM Host"] flow_file_nexusreader_application_dependencyinjection_cs_file_1["DependencyInjection"] flow_file_nexusreader_application_mappings_mappingconfig_cs_file_1["MappingConfig"] flow_file_nexusreader_infrastructure_dependencyinjection_cs_file_1["DependencyInjection"] flow_file_nexusreader_web_client_nexusreader_web_client_csproj_file_1["NexusReader.Web.Client.csproj"] flow_type_nexusreader_application_dependencyinjection_cs_configured_via_addmapsterconfiguration_extension_10[/"configured via AddMapsterConfiguration extension"/] flow_type_nexusreader_application_dependencyinjection_cs_handlers_discovered_in_this_assembly_11[/"handlers discovered in this assembly"/] flow_type_nexusreader_application_mappings_mappingconfig_cs_servicemapper_20[/"ServiceMapper"/] flow_type_nexusreader_application_mappings_mappingconfig_cs_typeadapterconfig_instance_19[/"TypeAdapterConfig (instance)"/] flow_type_nexusreader_infrastructure_dependencyinjection_cs_appdbcontext_36[/"AppDbContext"/] flow_type_nexusreader_infrastructure_dependencyinjection_cs_appdbcontext_41[/"AppDbContext"/] flow_type_nexusreader_web_client_program_cs_configured_httpclient_40[/"configured HttpClient"/] flow_type_nexusreader_web_client_program_cs_n_a_55[/"N/A"/] flow_type_nexusreader_web_client_program_cs_nexusauthenticationstateprovider_33[/"NexusAuthenticationStateProvider"/] flow_type_nexusreader_web_client_program_cs_throwingdbcontextfactory_49[/"ThrowingDbContextFactory"/] flow_type_nexusreader_web_client_program_cs_wasmepubreader_56[/"WasmEpubReader"/] flow_type_nexusreader_web_client_program_cs_wasmknowledgeservice_38[/"WasmKnowledgeService"/] flow_type_nexusreader_web_client_program_cs_webplatformservice_18[/"WebPlatformService"/] flow_file_nexusreader_application_dependencyinjection_cs_file_1 -->|Mapster configuration / mapping profiles| flow_type_nexusreader_application_dependencyinjection_cs_configured_via_addmapsterconfiguration_extension_10 flow_file_nexusreader_application_dependencyinjection_cs_file_1 -->|MediatR handlers from this assembly| flow_type_nexusreader_application_dependencyinjection_cs_handlers_discovered_in_this_assembly_11 flow_file_nexusreader_application_mappings_mappingconfig_cs_file_1 -->|IMapper| flow_type_nexusreader_application_mappings_mappingconfig_cs_servicemapper_20 flow_file_nexusreader_application_mappings_mappingconfig_cs_file_1 -->|TypeAdapterConfig| flow_type_nexusreader_application_mappings_mappingconfig_cs_typeadapterconfig_instance_19 flow_file_nexusreader_infrastructure_dependencyinjection_cs_file_1 -->|AppDbContext DbContextFactory| flow_type_nexusreader_infrastructure_dependencyinjection_cs_appdbcontext_36 flow_file_nexusreader_infrastructure_dependencyinjection_cs_file_1 -->|AppDbContext DbContext| flow_type_nexusreader_infrastructure_dependencyinjection_cs_appdbcontext_41 flow_file_nexusreader_web_client_nexusreader_web_client_csproj_file_1 -->|unknown| flow_method_nexusreader_web_client_nexusreader_web_client_csproj_project_configuration_1 flow_file_nexusreader_web_client_program_cs_file_1 -->|unknown| flow_method_nexusreader_web_client_program_cs_run_wasm_host_59 flow_file_nexusreader_web_client_program_cs_file_1 -->|uses| flow_type_nexusreader_web_client_program_cs_configured_httpclient_40 flow_file_nexusreader_web_client_program_cs_file_1 -->|application services via extension| flow_type_nexusreader_web_client_program_cs_n_a_55 flow_file_nexusreader_web_client_program_cs_file_1 -->|NexusAuthenticationStateProvider| flow_type_nexusreader_web_client_program_cs_nexusauthenticationstateprovider_33 flow_file_nexusreader_web_client_program_cs_file_1 -->|IDbContextFactory AppDbContext>| flow_type_nexusreader_web_client_program_cs_throwingdbcontextfactory_49 flow_file_nexusreader_web_client_program_cs_file_1 -->|IEpubReader| flow_type_nexusreader_web_client_program_cs_wasmepubreader_56 flow_file_nexusreader_web_client_program_cs_file_1 -->|IKnowledgeService| flow_type_nexusreader_web_client_program_cs_wasmknowledgeservice_38 flow_file_nexusreader_web_client_program_cs_file_1 -->|IPlatformService| flow_type_nexusreader_web_client_program_cs_webplatformservice_18 click flow_file_nexusreader_application_mappings_mappingconfig_cs_file_1 href "vscode://file/NexusReader.Application/Mappings/MappingConfig.cs:1:1" "Open source" click flow_type_nexusreader_application_mappings_mappingconfig_cs_typeadapterconfig_instance_19 href "vscode://file/NexusReader.Application/Mappings/MappingConfig.cs:19:1" "Open source" click flow_type_nexusreader_application_mappings_mappingconfig_cs_servicemapper_20 href "vscode://file/NexusReader.Application/Mappings/MappingConfig.cs:20:1" "Open source" click flow_file_nexusreader_web_client_program_cs_file_1 href "vscode://file/NexusReader.Web.Client/Program.cs:1:1" "Open source" click flow_type_nexusreader_web_client_program_cs_webplatformservice_18 href "vscode://file/NexusReader.Web.Client/Program.cs:18:1" "Open source" click flow_type_nexusreader_web_client_program_cs_nexusauthenticationstateprovider_33 href "vscode://file/NexusReader.Web.Client/Program.cs:33:1" "Open source" click flow_type_nexusreader_web_client_program_cs_wasmknowledgeservice_38 href "vscode://file/NexusReader.Web.Client/Program.cs:38:1" "Open source" click flow_type_nexusreader_web_client_program_cs_configured_httpclient_40 href "vscode://file/NexusReader.Web.Client/Program.cs:40:1" "Open source" click flow_type_nexusreader_web_client_program_cs_throwingdbcontextfactory_49 href "vscode://file/NexusReader.Web.Client/Program.cs:49:1" "Open source" click flow_type_nexusreader_web_client_program_cs_n_a_55 href "vscode://file/NexusReader.Web.Client/Program.cs:55:1" "Open source" click flow_type_nexusreader_web_client_program_cs_wasmepubreader_56 href "vscode://file/NexusReader.Web.Client/Program.cs:56:1" "Open source" click flow_method_nexusreader_web_client_program_cs_run_wasm_host_59 href "vscode://file/NexusReader.Web.Client/Program.cs:59:1" "Open source" click flow_file_nexusreader_web_client_nexusreader_web_client_csproj_file_1 href "vscode://file/NexusReader.Web.Client/NexusReader.Web.Client.csproj:1:1" "Open source" click flow_method_nexusreader_web_client_nexusreader_web_client_csproj_project_configuration_1 href "vscode://file/NexusReader.Web.Client/NexusReader.Web.Client.csproj:1:1" "Open source" click flow_file_nexusreader_application_dependencyinjection_cs_file_1 href "vscode://file/NexusReader.Application/DependencyInjection.cs:1:1" "Open source" click flow_type_nexusreader_application_dependencyinjection_cs_configured_via_addmapsterconfiguration_extension_10 href "vscode://file/NexusReader.Application/DependencyInjection.cs:10:1" "Open source" click flow_type_nexusreader_application_dependencyinjection_cs_handlers_discovered_in_this_assembly_11 href "vscode://file/NexusReader.Application/DependencyInjection.cs:11:1" "Open source" click flow_file_nexusreader_infrastructure_dependencyinjection_cs_file_1 href "vscode://file/NexusReader.Infrastructure/DependencyInjection.cs:1:1" "Open source" click flow_type_nexusreader_infrastructure_dependencyinjection_cs_appdbcontext_36 href "vscode://file/NexusReader.Infrastructure/DependencyInjection.cs:36:1" "Open source" click flow_type_nexusreader_infrastructure_dependencyinjection_cs_appdbcontext_41 href "vscode://file/NexusReader.Infrastructure/DependencyInjection.cs:41:1" "Open source" ``` This diagram details how Web.Client's Program.cs configures the WASM host: mapping profiles, MediatR handlers, AppDbContext factories and client-specific service substitutions (WasmKnowledgeService, WebPlatformService). It shows where Infrastructure and Application DI extensions are invoked. === DIAGRAM 3: Program.cs Flow (primary-runtime) === ```mermaid --- config: flowchart: defaultRenderer: "elk" --- flowchart TD subgraph flow_1_nexusreader_web_client_program_cs["Program.cs"] end flow_file_nexusreader_application_abstractions_services_iknowledgeservice_cs_file_1["IKnowledgeService"] flow_file_nexusreader_application_abstractions_services_iplatformservice_cs_file_1["IPlatformService"] flow_file_nexusreader_web_client_program_cs_file_1["Program.cs"] flow_method_nexusreader_application_abstractions_services_iknowledgeservice_cs_askquestionasync_15["AskQuestionAsync"] flow_method_nexusreader_application_abstractions_services_iknowledgeservice_cs_verifygroundednessasync_13["VerifyGroundednessAsync"] flow_method_nexusreader_web_client_program_cs_findauthorbynameasync_88["FindAuthorByNameAsync"] flow_method_nexusreader_web_client_program_cs_getservice_71["GetService"] flow_method_nexusreader_web_client_program_cs_program_top_level_startup_15["Program (top-level startup)"] flow_method_nexusreader_web_client_program_cs_run_wasm_host_59["Run WASM Host"] flow_action_nexusreader_web_client_program_cs_findauthorbynameasync_repository_read_88_88["Reads repository or persistence state"] flow_type_nexusreader_application_abstractions_services_iknowledgeservice_cs_groundednessresult_19[/"GroundednessResult"/] flow_type_nexusreader_web_client_program_cs_configured_httpclient_40[/"configured HttpClient"/] flow_type_nexusreader_web_client_program_cs_n_a_55[/"N/A"/] flow_type_nexusreader_web_client_program_cs_nexusauthenticationstateprovider_33[/"NexusAuthenticationStateProvider"/] flow_type_nexusreader_web_client_program_cs_throwingbookstorageservice_74[/"ThrowingBookStorageService"/] flow_type_nexusreader_web_client_program_cs_throwingdbcontextfactory_49[/"ThrowingDbContextFactory"/] flow_type_nexusreader_web_client_program_cs_throwingdbcontextfactory_61[/"ThrowingDbContextFactory"/] flow_type_nexusreader_web_client_program_cs_throwingebookrepository_84[/"ThrowingEbookRepository"/] flow_type_nexusreader_web_client_program_cs_throwingembeddinggenerator_66[/"ThrowingEmbeddingGenerator"/] flow_type_nexusreader_web_client_program_cs_throwingsyncbroadcaster_94[/"ThrowingSyncBroadcaster"/] flow_type_nexusreader_web_client_program_cs_wasmepubreader_56[/"WasmEpubReader"/] flow_type_nexusreader_web_client_program_cs_wasmknowledgeservice_38[/"WasmKnowledgeService"/] flow_type_nexusreader_web_client_program_cs_webplatformservice_18[/"WebPlatformService"/] flow_action_nexusreader_web_client_program_cs_getservice_return_71_71(["returns null"]) flow_file_nexusreader_application_abstractions_services_iknowledgeservice_cs_file_1 -->|dto GroundednessResult| flow_type_nexusreader_application_abstractions_services_iknowledgeservice_cs_groundednessresult_19 flow_file_nexusreader_web_client_program_cs_file_1 -->|FindAuthorByNameAsync| flow_method_nexusreader_web_client_program_cs_findauthorbynameasync_88 flow_file_nexusreader_web_client_program_cs_file_1 -->|GetService| flow_method_nexusreader_web_client_program_cs_getservice_71 flow_file_nexusreader_web_client_program_cs_file_1 -->|Program top-level startup| flow_method_nexusreader_web_client_program_cs_program_top_level_startup_15 flow_file_nexusreader_web_client_program_cs_file_1 -->|unknown| flow_method_nexusreader_web_client_program_cs_run_wasm_host_59 flow_file_nexusreader_web_client_program_cs_file_1 -->|uses| flow_type_nexusreader_web_client_program_cs_configured_httpclient_40 flow_file_nexusreader_web_client_program_cs_file_1 -->|application services via extension| flow_type_nexusreader_web_client_program_cs_n_a_55 flow_file_nexusreader_web_client_program_cs_file_1 -->|NexusAuthenticationStateProvider| flow_type_nexusreader_web_client_program_cs_nexusauthenticationstateprovider_33 flow_file_nexusreader_web_client_program_cs_file_1 -->|model ThrowingBookStorageService| flow_type_nexusreader_web_client_program_cs_throwingbookstorageservice_74 flow_file_nexusreader_web_client_program_cs_file_1 -->|IDbContextFactory AppDbContext>| flow_type_nexusreader_web_client_program_cs_throwingdbcontextfactory_49 flow_file_nexusreader_web_client_program_cs_file_1 -->|model ThrowingDbContextFactory| flow_type_nexusreader_web_client_program_cs_throwingdbcontextfactory_61 flow_file_nexusreader_web_client_program_cs_file_1 -->|model ThrowingEbookRepository| flow_type_nexusreader_web_client_program_cs_throwingebookrepository_84 flow_file_nexusreader_web_client_program_cs_file_1 -->|model ThrowingEmbeddingGenerator| flow_type_nexusreader_web_client_program_cs_throwingembeddinggenerator_66 flow_file_nexusreader_web_client_program_cs_file_1 -->|model ThrowingSyncBroadcaster| flow_type_nexusreader_web_client_program_cs_throwingsyncbroadcaster_94 flow_file_nexusreader_web_client_program_cs_file_1 -->|IEpubReader| flow_type_nexusreader_web_client_program_cs_wasmepubreader_56 flow_file_nexusreader_web_client_program_cs_file_1 -->|IKnowledgeService| flow_type_nexusreader_web_client_program_cs_wasmknowledgeservice_38 flow_file_nexusreader_web_client_program_cs_file_1 -->|IPlatformService| flow_type_nexusreader_web_client_program_cs_webplatformservice_18 flow_method_nexusreader_web_client_program_cs_findauthorbynameasync_88 -->|Reads repository or persistence state| flow_action_nexusreader_web_client_program_cs_findauthorbynameasync_repository_read_88_88 flow_method_nexusreader_web_client_program_cs_getservice_71 -->|returns null| flow_action_nexusreader_web_client_program_cs_getservice_return_71_71 click flow_file_nexusreader_application_abstractions_services_iknowledgeservice_cs_file_1 href "vscode://file/NexusReader.Application/Abstractions/Services/IKnowledgeService.cs:1:1" "Open source" click flow_type_nexusreader_application_abstractions_services_iknowledgeservice_cs_groundednessresult_19 href "vscode://file/NexusReader.Application/Abstractions/Services/IKnowledgeService.cs:19:1" "Open source" click flow_method_nexusreader_application_abstractions_services_iknowledgeservice_cs_verifygroundednessasync_13 href "vscode://file/NexusReader.Application/Abstractions/Services/IKnowledgeService.cs:13:1" "Open source" click flow_file_nexusreader_application_abstractions_services_iplatformservice_cs_file_1 href "vscode://file/NexusReader.Application/Abstractions/Services/IPlatformService.cs:1:1" "Open source" click flow_method_nexusreader_application_abstractions_services_iknowledgeservice_cs_askquestionasync_15 href "vscode://file/NexusReader.Application/Abstractions/Services/IKnowledgeService.cs:15:1" "Open source" click flow_file_nexusreader_web_client_program_cs_file_1 href "vscode://file/NexusReader.Web.Client/Program.cs:1:1" "Open source" click flow_method_nexusreader_web_client_program_cs_program_top_level_startup_15 href "vscode://file/NexusReader.Web.Client/Program.cs:15:1" "Open source" click flow_method_nexusreader_web_client_program_cs_getservice_71 href "vscode://file/NexusReader.Web.Client/Program.cs:71:1" "Open source" click flow_action_nexusreader_web_client_program_cs_getservice_return_71_71 href "vscode://file/NexusReader.Web.Client/Program.cs:71:1" "Open source" click flow_method_nexusreader_web_client_program_cs_findauthorbynameasync_88 href "vscode://file/NexusReader.Web.Client/Program.cs:88:1" "Open source" click flow_action_nexusreader_web_client_program_cs_findauthorbynameasync_repository_read_88_88 href "vscode://file/NexusReader.Web.Client/Program.cs:88:1" "Open source" click flow_type_nexusreader_web_client_program_cs_throwingdbcontextfactory_61 href "vscode://file/NexusReader.Web.Client/Program.cs:61:1" "Open source" click flow_type_nexusreader_web_client_program_cs_throwingembeddinggenerator_66 href "vscode://file/NexusReader.Web.Client/Program.cs:66:1" "Open source" click flow_type_nexusreader_web_client_program_cs_throwingbookstorageservice_74 href "vscode://file/NexusReader.Web.Client/Program.cs:74:1" "Open source" click flow_type_nexusreader_web_client_program_cs_throwingebookrepository_84 href "vscode://file/NexusReader.Web.Client/Program.cs:84:1" "Open source" click flow_type_nexusreader_web_client_program_cs_throwingsyncbroadcaster_94 href "vscode://file/NexusReader.Web.Client/Program.cs:94:1" "Open source" click flow_type_nexusreader_web_client_program_cs_webplatformservice_18 href "vscode://file/NexusReader.Web.Client/Program.cs:18:1" "Open source" click flow_type_nexusreader_web_client_program_cs_nexusauthenticationstateprovider_33 href "vscode://file/NexusReader.Web.Client/Program.cs:33:1" "Open source" click flow_type_nexusreader_web_client_program_cs_wasmknowledgeservice_38 href "vscode://file/NexusReader.Web.Client/Program.cs:38:1" "Open source" click flow_type_nexusreader_web_client_program_cs_configured_httpclient_40 href "vscode://file/NexusReader.Web.Client/Program.cs:40:1" "Open source" click flow_type_nexusreader_web_client_program_cs_throwingdbcontextfactory_49 href "vscode://file/NexusReader.Web.Client/Program.cs:49:1" "Open source" click flow_type_nexusreader_web_client_program_cs_n_a_55 href "vscode://file/NexusReader.Web.Client/Program.cs:55:1" "Open source" click flow_type_nexusreader_web_client_program_cs_wasmepubreader_56 href "vscode://file/NexusReader.Web.Client/Program.cs:56:1" "Open source" click flow_method_nexusreader_web_client_program_cs_run_wasm_host_59 href "vscode://file/NexusReader.Web.Client/Program.cs:59:1" "Open source" ``` This flow emphasizes Program.cs usage: which services are resolved on the WASM client, which are replaced by throwing stubs or Wasm-specific implementations, and how client startup triggers queries/commands. === DIAGRAM 4: Program.cs Execution Control Flow (control-flow) === ```mermaid flowchart TD subgraph NexusReader_Application_Abstractions_Services_IKnowledgeService["IKnowledgeService"] end subgraph NexusReader_Application_Abstractions_Services_IPlatformService["IPlatformService"] end subgraph NexusReader_Web_Client_Program["Program"] end flow_file_nexusreader_application_abstractions_services_iplatformservice_cs_file_1["IPlatformService"] flow_file_nexusreader_web_client_program_cs_file_1["Program.cs"] flow_method_nexusreader_application_abstractions_services_iknowledgeservice_cs_askquestionasync_15["AskQuestionAsync"] flow_method_nexusreader_application_abstractions_services_iknowledgeservice_cs_verifygroundednessasync_13["VerifyGroundednessAsync"] flow_method_nexusreader_application_abstractions_services_iplatformservice_cs_getdevicecontext_10["GetDeviceContext"] flow_method_nexusreader_application_abstractions_services_iplatformservice_cs_vibrateasync_9["VibrateAsync"] flow_method_nexusreader_application_abstractions_services_iplatformservice_cs_vibrateerrorasync_8["VibrateErrorAsync"] flow_method_nexusreader_application_abstractions_services_iplatformservice_cs_vibratesuccessasync_7["VibrateSuccessAsync"] flow_method_nexusreader_web_client_program_cs_findauthorbynameasync_88["FindAuthorByNameAsync"] flow_method_nexusreader_web_client_program_cs_getservice_71["GetService"] flow_method_nexusreader_web_client_program_cs_program_top_level_startup_15["Program (top-level startup)"] flow_method_nexusreader_web_client_program_cs_run_wasm_host_59["Run WASM Host"] flow_action_nexusreader_web_client_program_cs_findauthorbynameasync_repository_read_88_88["Reads repository or persistence state"] flow_action_nexusreader_application_commands_ai_verifygroundednesscommand_cs_handle_return_20_20(["Returns result"]) flow_action_nexusreader_application_queries_library_asklibraryquestionquery_cs_handle_return_30_30(["Returns result"]) flow_file_nexusreader_application_abstractions_services_iplatformservice_cs_file_1 -->|GetDeviceContext| flow_method_nexusreader_application_abstractions_services_iplatformservice_cs_getdevicecontext_10 flow_file_nexusreader_application_abstractions_services_iplatformservice_cs_file_1 -->|VibrateAsync| flow_method_nexusreader_application_abstractions_services_iplatformservice_cs_vibrateasync_9 flow_file_nexusreader_application_abstractions_services_iplatformservice_cs_file_1 -->|VibrateErrorAsync| flow_method_nexusreader_application_abstractions_services_iplatformservice_cs_vibrateerrorasync_8 flow_file_nexusreader_application_abstractions_services_iplatformservice_cs_file_1 -->|VibrateSuccessAsync| flow_method_nexusreader_application_abstractions_services_iplatformservice_cs_vibratesuccessasync_7 flow_method_nexusreader_web_client_program_cs_findauthorbynameasync_88 -->|Reads repository or persistence state| flow_action_nexusreader_web_client_program_cs_findauthorbynameasync_repository_read_88_88 flow_method_nexusreader_web_client_program_cs_getservice_71 -->|returns null| flow_action_nexusreader_web_client_program_cs_getservice_return_71_71 click flow_action_nexusreader_application_commands_ai_verifygroundednesscommand_cs_handle_return_20_20 href "vscode://file/NexusReader.Application/Commands/AI/VerifyGroundednessCommand.cs:20:1" "Open source" click flow_method_nexusreader_application_abstractions_services_iknowledgeservice_cs_verifygroundednessasync_13 href "vscode://file/NexusReader.Application/Abstractions/Services/IKnowledgeService.cs:13:1" "Open source" click flow_file_nexusreader_application_abstractions_services_iplatformservice_cs_file_1 href "vscode://file/NexusReader.Application/Abstractions/Services/IPlatformService.cs:1:1" "Open source" click flow_method_nexusreader_application_abstractions_services_iplatformservice_cs_vibratesuccessasync_7 href "vscode://file/NexusReader.Application/Abstractions/Services/IPlatformService.cs:7:1" "Open source" click flow_method_nexusreader_application_abstractions_services_iplatformservice_cs_vibrateerrorasync_8 href "vscode://file/NexusReader.Application/Abstractions/Services/IPlatformService.cs:8:1" "Open source" click flow_method_nexusreader_application_abstractions_services_iplatformservice_cs_vibrateasync_9 href "vscode://file/NexusReader.Application/Abstractions/Services/IPlatformService.cs:9:1" "Open source" click flow_method_nexusreader_application_queries_library_asklibraryquestionquery_cs_handle_return_30_30 href "vscode://file/NexusReader.Application/Queries/Library/AskLibraryQuestionQuery.cs:30:1" "Open source" click flow_method_nexusreader_application_abstractions_services_iknowledgeservice_cs_askquestionasync_15 href "vscode://file/NexusReader.Application/Abstractions/Services/IKnowledgeService.cs:15:1" "Open source" click flow_file_nexusreader_web_client_program_cs_file_1 href "vscode://file/NexusReader.Web.Client/Program.cs:1:1" "Open source" click flow_method_nexusreader_web_client_program_cs_program_top_level_startup_15 href "vscode://file/NexusReader.Web.Client/Program.cs:15:1" "Open source" click flow_method_nexusreader_web_client_program_cs_getservice_71 href "vscode://file/NexusReader.Web.Client/Program.cs:71:1" "Open source" click flow_action_nexusreader_web_client_program_cs_getservice_return_71_71 href "vscode://file/NexusReader.Web.Client/Program.cs:71:1" "Open source" click flow_method_nexusreader_web_client_program_cs_findauthorbynameasync_88 href "vscode://file/NexusReader.Web.Client/Program.cs:88:1" "Open source" click flow_action_nexusreader_web_client_program_cs_findauthorbynameasync_repository_read_88_88 href "vscode://file/NexusReader.Web.Client/Program.cs:88:1" "Open source" click flow_method_nexusreader_web_client_program_cs_run_wasm_host_59 href "vscode://file/NexusReader.Web.Client/Program.cs:59:1" "Open source" ``` This control-flow diagram traces runtime calls through Program into application commands/queries and platform service calls (e.g., vibration). It illustrates which runtime entrypoints trigger domain/application logic. === DIAGRAM 5: Program.cs Contracts and Entities (class-diagram) === ```mermaid classDiagram class flow_file_nexusreader_application_abstractions_services_iknowledgeservice_cs_file_1["IKnowledgeService"] class flow_file_nexusreader_application_abstractions_services_iplatformservice_cs_file_1["IPlatformService"] class flow_file_nexusreader_web_client_program_cs_file_1["Program.cs"] class flow_type_nexusreader_application_abstractions_services_iknowledgeservice_cs_groundednessresult_19["GroundednessResult"] class flow_type_nexusreader_application_abstractions_services_iplatformservice_cs_devicecontext_13["DeviceContext"] class flow_type_nexusreader_application_abstractions_services_iplatformservice_cs_devicetype_20["DeviceType"] class flow_type_nexusreader_application_abstractions_services_iplatformservice_cs_displayorientation_28["DisplayOrientation"] class flow_type_nexusreader_web_client_program_cs_configured_httpclient_40["configured HttpClient"] class flow_type_nexusreader_web_client_program_cs_n_a_55["N/A"] class flow_type_nexusreader_web_client_program_cs_nexusauthenticationstateprovider_33["NexusAuthenticationStateProvider"] class flow_type_nexusreader_web_client_program_cs_throwingbookstorageservice_74["ThrowingBookStorageService"] class flow_type_nexusreader_web_client_program_cs_throwingdbcontextfactory_49["ThrowingDbContextFactory"] class flow_type_nexusreader_web_client_program_cs_throwingdbcontextfactory_61["ThrowingDbContextFactory"] class flow_type_nexusreader_web_client_program_cs_throwingebookrepository_84["ThrowingEbookRepository"] class flow_type_nexusreader_web_client_program_cs_throwingembeddinggenerator_66["ThrowingEmbeddingGenerator"] class flow_type_nexusreader_web_client_program_cs_throwingsyncbroadcaster_94["ThrowingSyncBroadcaster"] class flow_type_nexusreader_web_client_program_cs_wasmepubreader_56["WasmEpubReader"] class flow_type_nexusreader_web_client_program_cs_wasmknowledgeservice_38["WasmKnowledgeService"] class flow_type_nexusreader_web_client_program_cs_webplatformservice_18["WebPlatformService"] flow_file_nexusreader_application_abstractions_services_iknowledgeservice_cs_file_1 --> flow_type_nexusreader_application_abstractions_services_iknowledgeservice_cs_groundednessresult_19 : dto GroundednessResult flow_file_nexusreader_application_abstractions_services_iplatformservice_cs_file_1 --> flow_type_nexusreader_application_abstractions_services_iplatformservice_cs_devicecontext_13 : dto DeviceContext flow_file_nexusreader_application_abstractions_services_iplatformservice_cs_file_1 --> flow_type_nexusreader_application_abstractions_services_iplatformservice_cs_devicetype_20 : enum DeviceType flow_file_nexusreader_application_abstractions_services_iplatformservice_cs_file_1 --> flow_type_nexusreader_application_abstractions_services_iplatformservice_cs_displayorientation_28 : enum DisplayOrientation flow_file_nexusreader_web_client_program_cs_file_1 --> flow_type_nexusreader_web_client_program_cs_throwingbookstorageservice_74 : model ThrowingBookStorageService flow_file_nexusreader_web_client_program_cs_file_1 --> flow_type_nexusreader_web_client_program_cs_throwingdbcontextfactory_61 : model ThrowingDbContextFactory flow_file_nexusreader_web_client_program_cs_file_1 --> flow_type_nexusreader_web_client_program_cs_throwingebookrepository_84 : model ThrowingEbookRepository flow_file_nexusreader_web_client_program_cs_file_1 --> flow_type_nexusreader_web_client_program_cs_throwingembeddinggenerator_66 : model ThrowingEmbeddingGenerator flow_file_nexusreader_web_client_program_cs_file_1 --> flow_type_nexusreader_web_client_program_cs_throwingsyncbroadcaster_94 : model ThrowingSyncBroadcaster click flow_file_nexusreader_application_abstractions_services_iknowledgeservice_cs_file_1 href "vscode://file/NexusReader.Application/Abstractions/Services/IKnowledgeService.cs:1:1" "Open source" click flow_type_nexusreader_application_abstractions_services_iknowledgeservice_cs_groundednessresult_19 href "vscode://file/NexusReader.Application/Abstractions/Services/IKnowledgeService.cs:19:1" "Open source" click flow_file_nexusreader_application_abstractions_services_iplatformservice_cs_file_1 href "vscode://file/NexusReader.Application/Abstractions/Services/IPlatformService.cs:1:1" "Open source" click flow_type_nexusreader_application_abstractions_services_iplatformservice_cs_devicecontext_13 href "vscode://file/NexusReader.Application/Abstractions/Services/IPlatformService.cs:13:1" "Open source" click flow_type_nexusreader_application_abstractions_services_iplatformservice_cs_devicetype_20 href "vscode://file/NexusReader.Application/Abstractions/Services/IPlatformService.cs:20:1" "Open source" click flow_type_nexusreader_application_abstractions_services_iplatformservice_cs_displayorientation_28 href "vscode://file/NexusReader.Application/Abstractions/Services/IPlatformService.cs:28:1" "Open source" click flow_file_nexusreader_web_client_program_cs_file_1 href "vscode://file/NexusReader.Web.Client/Program.cs:1:1" "Open source" click flow_type_nexusreader_web_client_program_cs_throwingdbcontextfactory_61 href "vscode://file/NexusReader.Web.Client/Program.cs:61:1" "Open source" click flow_type_nexusreader_web_client_program_cs_throwingembeddinggenerator_66 href "vscode://file/NexusReader.Web.Client/Program.cs:66:1" "Open source" click flow_type_nexusreader_web_client_program_cs_throwingbookstorageservice_74 href "vscode://file/NexusReader.Web.Client/Program.cs:74:1" "Open source" click flow_type_nexusreader_web_client_program_cs_throwingebookrepository_84 href "vscode://file/NexusReader.Web.Client/Program.cs:84:1" "Open source" click flow_type_nexusreader_web_client_program_cs_throwingsyncbroadcaster_94 href "vscode://file/NexusReader.Web.Client/Program.cs:94:1" "Open source" click flow_type_nexusreader_web_client_program_cs_webplatformservice_18 href "vscode://file/NexusReader.Web.Client/Program.cs:18:1" "Open source" click flow_type_nexusreader_web_client_program_cs_nexusauthenticationstateprovider_33 href "vscode://file/NexusReader.Web.Client/Program.cs:33:1" "Open source" click flow_type_nexusreader_web_client_program_cs_wasmknowledgeservice_38 href "vscode://file/NexusReader.Web.Client/Program.cs:38:1" "Open source" click flow_type_nexusreader_web_client_program_cs_configured_httpclient_40 href "vscode://file/NexusReader.Web.Client/Program.cs:40:1" "Open source" click flow_type_nexusreader_web_client_program_cs_throwingdbcontextfactory_49 href "vscode://file/NexusReader.Web.Client/Program.cs:49:1" "Open source" click flow_type_nexusreader_web_client_program_cs_n_a_55 href "vscode://file/NexusReader.Web.Client/Program.cs:55:1" "Open source" click flow_type_nexusreader_web_client_program_cs_wasmepubreader_56 href "vscode://file/NexusReader.Web.Client/Program.cs:56:1" "Open source" ``` This class diagram identifies DTOs and platform enums owned by Application abstractions and client-side runtime models substituted in Web.Client. It clarifies contract ownership vs concrete client models. === DIAGRAM 6: Program.cs Layer View (dependency-map) === ```mermaid --- config: flowchart: defaultRenderer: "elk" --- flowchart LR subgraph layer_application["application"] flow_file_nexusreader_application_abstractions_services_iknowledgeservice_cs_file_1["IKnowledgeService"] flow_file_nexusreader_application_abstractions_services_iplatformservice_cs_file_1["IPlatformService"] flow_method_nexusreader_application_abstractions_services_iknowledgeservice_cs_askquestionasync_15["AskQuestionAsync"] flow_method_nexusreader_application_abstractions_services_iknowledgeservice_cs_verifygroundednessasync_13["VerifyGroundednessAsync"] flow_type_nexusreader_application_abstractions_services_iknowledgeservice_cs_groundednessresult_19[/"GroundednessResult"/] flow_file_nexusreader_application_abstractions_services_iknowledgeservice_cs_file_1 -->|dto GroundednessResult| flow_type_nexusreader_application_abstractions_services_iknowledgeservice_cs_groundednessresult_19 end subgraph layer_frontend["frontend"] flow_file_nexusreader_web_client_program_cs_file_1["Program.cs"] flow_action_nexusreader_web_client_program_cs_findauthorbynameasync_repository_read_88_88["Reads repository or persistence state"] flow_type_nexusreader_web_client_program_cs_configured_httpclient_40[/"configured HttpClient"/] flow_type_nexusreader_web_client_program_cs_nexusauthenticationstateprovider_33[/"NexusAuthenticationStateProvider"/] flow_type_nexusreader_web_client_program_cs_throwingbookstorageservice_74[/"ThrowingBookStorageService"/] flow_type_nexusreader_web_client_program_cs_throwingdbcontextfactory_49[/"ThrowingDbContextFactory"/] flow_type_nexusreader_web_client_program_cs_throwingdbcontextfactory_61[/"ThrowingDbContextFactory"/] flow_type_nexusreader_web_client_program_cs_throwingebookrepository_84[/"ThrowingEbookRepository"/] flow_type_nexusreader_web_client_program_cs_throwingembeddinggenerator_66[/"ThrowingEmbeddingGenerator"/] flow_type_nexusreader_web_client_program_cs_throwingsyncbroadcaster_94[/"ThrowingSyncBroadcaster"/] flow_type_nexusreader_web_client_program_cs_wasmknowledgeservice_38[/"WasmKnowledgeService"/] flow_type_nexusreader_web_client_program_cs_webplatformservice_18[/"WebPlatformService"/] flow_action_nexusreader_web_client_program_cs_getservice_return_71_71(["returns null"]) flow_file_nexusreader_web_client_program_cs_file_1 -->|uses| flow_type_nexusreader_web_client_program_cs_configured_httpclient_40 flow_file_nexusreader_web_client_program_cs_file_1 -->|NexusAuthenticationStateProvider| flow_type_nexusreader_web_client_program_cs_nexusauthenticationstateprovider_33 flow_file_nexusreader_web_client_program_cs_file_1 -->|model ThrowingBookStorageService| flow_type_nexusreader_web_client_program_cs_throwingbookstorageservice_74 flow_file_nexusreader_web_client_program_cs_file_1 -->|IDbContextFactory AppDbContext>| flow_type_nexusreader_web_client_program_cs_throwingdbcontextfactory_49 flow_file_nexusreader_web_client_program_cs_file_1 -->|model ThrowingDbContextFactory| flow_type_nexusreader_web_client_program_cs_throwingdbcontextfactory_61 flow_file_nexusreader_web_client_program_cs_file_1 -->|model ThrowingEbookRepository| flow_type_nexusreader_web_client_program_cs_throwingebookrepository_84 flow_file_nexusreader_web_client_program_cs_file_1 -->|model ThrowingEmbeddingGenerator| flow_type_nexusreader_web_client_program_cs_throwingembeddinggenerator_66 flow_file_nexusreader_web_client_program_cs_file_1 -->|model ThrowingSyncBroadcaster| flow_type_nexusreader_web_client_program_cs_throwingsyncbroadcaster_94 flow_file_nexusreader_web_client_program_cs_file_1 -->|IKnowledgeService| flow_type_nexusreader_web_client_program_cs_wasmknowledgeservice_38 flow_file_nexusreader_web_client_program_cs_file_1 -->|IPlatformService| flow_type_nexusreader_web_client_program_cs_webplatformservice_18 end click flow_file_nexusreader_application_abstractions_services_iknowledgeservice_cs_file_1 href "vscode://file/NexusReader.Application/Abstractions/Services/IKnowledgeService.cs:1:1" "Open source" click flow_type_nexusreader_application_abstractions_services_iknowledgeservice_cs_groundednessresult_19 href "vscode://file/NexusReader.Application/Abstractions/Services/IKnowledgeService.cs:19:1" "Open source" click flow_method_nexusreader_application_abstractions_services_iknowledgeservice_cs_verifygroundednessasync_13 href "vscode://file/NexusReader.Application/Abstractions/Services/IKnowledgeService.cs:13:1" "Open source" click flow_file_nexusreader_application_abstractions_services_iplatformservice_cs_file_1 href "vscode://file/NexusReader.Application/Abstractions/Services/IPlatformService.cs:1:1" "Open source" click flow_method_nexusreader_application_abstractions_services_iknowledgeservice_cs_askquestionasync_15 href "vscode://file/NexusReader.Application/Abstractions/Services/IKnowledgeService.cs:15:1" "Open source" click flow_file_nexusreader_web_client_program_cs_file_1 href "vscode://file/NexusReader.Web.Client/Program.cs:1:1" "Open source" click flow_action_nexusreader_web_client_program_cs_getservice_return_71_71 href "vscode://file/NexusReader.Web.Client/Program.cs:71:1" "Open source" click flow_action_nexusreader_web_client_program_cs_findauthorbynameasync_repository_read_88_88 href "vscode://file/NexusReader.Web.Client/Program.cs:88:1" "Open source" click flow_type_nexusreader_web_client_program_cs_throwingdbcontextfactory_61 href "vscode://file/NexusReader.Web.Client/Program.cs:61:1" "Open source" click flow_type_nexusreader_web_client_program_cs_throwingembeddinggenerator_66 href "vscode://file/NexusReader.Web.Client/Program.cs:66:1" "Open source" click flow_type_nexusreader_web_client_program_cs_throwingbookstorageservice_74 href "vscode://file/NexusReader.Web.Client/Program.cs:74:1" "Open source" click flow_type_nexusreader_web_client_program_cs_throwingebookrepository_84 href "vscode://file/NexusReader.Web.Client/Program.cs:84:1" "Open source" click flow_type_nexusreader_web_client_program_cs_throwingsyncbroadcaster_94 href "vscode://file/NexusReader.Web.Client/Program.cs:94:1" "Open source" click flow_type_nexusreader_web_client_program_cs_webplatformservice_18 href "vscode://file/NexusReader.Web.Client/Program.cs:18:1" "Open source" click flow_type_nexusreader_web_client_program_cs_nexusauthenticationstateprovider_33 href "vscode://file/NexusReader.Web.Client/Program.cs:33:1" "Open source" click flow_type_nexusreader_web_client_program_cs_wasmknowledgeservice_38 href "vscode://file/NexusReader.Web.Client/Program.cs:38:1" "Open source" click flow_type_nexusreader_web_client_program_cs_configured_httpclient_40 href "vscode://file/NexusReader.Web.Client/Program.cs:40:1" "Open source" click flow_type_nexusreader_web_client_program_cs_throwingdbcontextfactory_49 href "vscode://file/NexusReader.Web.Client/Program.cs:49:1" "Open source" ``` Layer view clarifies boundaries: Application owns domain contracts and DTOs; frontend owns runtime wiring and substitutes server-only implementations with client-safe stubs or WASM-specific services. === DIAGRAM 7: Method Flow Details (method-flow) === ```mermaid flowchart TD subgraph NexusReader_Infrastructure_Helpers_ContentHasher["ContentHasher"] end subgraph NexusReader_Infrastructure_Helpers_JsonRepairHelper["JsonRepairHelper"] end subgraph NexusReader_Infrastructure_RealTime_SyncHub["SyncHub"] end flow_file_nexusreader_infrastructure_helpers_contenthasher_cs_file_1["ContentHasher"] flow_file_nexusreader_infrastructure_helpers_jsonrepairhelper_cs_file_1["JsonRepairHelper"] flow_method_nexusreader_infrastructure_helpers_contenthasher_cs_computehash_9["ComputeHash"] flow_method_nexusreader_infrastructure_helpers_jsonrepairhelper_cs_repair_8["Repair"] flow_method_nexusreader_infrastructure_realtime_synchub_cs_onconnectedasync_28["OnConnectedAsync"] flow_method_nexusreader_infrastructure_realtime_synchub_cs_ondisconnectedasync_38["OnDisconnectedAsync"] flow_method_nexusreader_infrastructure_realtime_synchub_cs_synchub_14["SyncHub"] flow_method_nexusreader_infrastructure_realtime_synchub_cs_updateprogress_19["UpdateProgress"] flow_action_nexusreader_infrastructure_helpers_contenthasher_cs_computehash_branch_11_11{"Evaluates branch condition"} flow_action_nexusreader_infrastructure_helpers_jsonrepairhelper_cs_repair_guard_clause_10_10{"Guards early exit or rejection path"} flow_action_nexusreader_ ``` This method-flow highlights Infrastructure helpers and the real-time SyncHub lifecycle (connect, disconnect, progress updates) plus utility flows (content hashing, JSON repair). It shows who owns runtime behaviours for syncing and data integrity. ### Key Files - NexusReader.Web/Program.cs (server entry) - NexusReader.Web.Client/Program.cs (WASM entry) - NexusReader.Maui/Program.cs (MAUI entry) - NexusReader.Application/DependencyInjection.cs - NexusReader.Infrastructure/DependencyInjection.cs - NexusReader.Application/Abstractions/Services/IKnowledgeService.cs - NexusReader.Infrastructure/RealTime/SyncHub.cs - NexusReader.Application/Mappings/MappingConfig.cs --- ## See Also - [Application Layer: Commands, Queries and DTOs](../domains/application-layer.md) - [Data Layer, EF Core and Repositories](../domains/data-and-persistence.md) - [Infrastructure Services: Knowledge, AI, Billing, Storage, Epub](../domains/infrastructure-services.md) - [Blazor WebAssembly Client: hosting, handlers, and platform services](../flows/web-client-wasm.md) - [MAUI Mobile Host: App wiring and platform services](../domains/maui-mobile.md) - [Real-Time Sync, SignalR and Broadcast](../flows/realtime-and-sync.md) - [Security, Identity and Authorization](../flows/security-identity-auth.md) - [Business Overview](../business/business-overview.md) - [Top Business Flows](../business/top-business-flows.md)