How raycal49/outage_clone works
Purpose and entry points
OutageMap is a full-stack outage visualization system: an ASP.NET Core server ingests and persists outage events, exposes map-ready data, and pushes updates; a TypeScript client renders the live outage map. Server composition starts in OutageMap.Server/Program.cs; client bootstrap is outagemap.client/src/main.tsx and outagemap.client/src/App.tsx.
Server API and realtime boundary
HTTP map access is handled by OutageMap.Server/Controllers/OutageMapController.cs. Realtime delivery uses the SignalR hub at OutageMap.Server/Hubs/OutageHub.cs. These are the server’s outward-facing contracts: REST-style retrieval for initial/current state and hub notifications for changes, consumed by outagemap.client/src/lib/outageHub.ts.
Ingestion and scheduled synchronization
A hosted poller, OutageMap.Server/Services/BackgroundServices/OutagePoller.cs, drives recurring synchronization through OutageMap.Server/Services/OutageSyncService.cs. Source abstraction is OutageMap.Server/Infrastructure/Http/IOutageSource.cs; production polling appears in OutageMap.Server/Infrastructure/Http/PollOutageSource.cs, while OutageMap.Server/Infrastructure/Http/FixtureOutageService.cs supports fixture-backed input. Feed endpoint/settings are isolated in OutageMap.Server/Infrastructure/Http/OutageFeedOptions.cs.
Validation, reconciliation, and update publication
Incoming DTOs enter through OutageMap.Server/Dtos/OutageDto.cs and are mapped into persisted entities by OutageMap.Server/Dtos/Mappers/OutageDtoToEntity.cs. OutageMap.Server/Services/OutageValidator.cs enforces input validity; OutageMap.Server/Services/OutageUpdater.cs applies detected changes. OutageMap.Server/Services/OutageSyncResult.cs carries synchronization outcomes, likely separating source-fetch/reconciliation results from controller and hub concerns.
Persistence and spatial response representation
Entity Framework Core persistence centers on OutageMap.Server/Models/AppDbContext.cs and OutageMap.Server/Models/OutageEntity.cs, with schema rules in OutageMap.Server/Models/OutageEntityConfiguration.cs. Database evolution is captured under OutageMap.Server/Migrations/. OutageMap.Server/Models/OutageEntityToGeojson.cs is the important API-format boundary: stored outage records are transformed into GeoJSON suitable for map rendering.
Read model and client map flow
OutageMap.Server/Services/IOutageReader.cs and OutageMap.Server/Services/OutageReader.cs provide a read-side service boundary between persisted data and API delivery. On the client, outagemap.client/src/hooks/useOutageFeed.ts obtains and maintains outage state, while outagemap.client/src/map/OutageMap.tsx, outagemap.client/src/map/layers.ts, and outagemap.client/src/map/interactions.ts render and interact with map features. Selection and detail UI flow through outagemap.client/src/hooks/useOutageSelection.ts and outagemap.client/src/components/OutagePopup.tsx.
Runtime, infrastructure, and verification
The server is .NET/ASP.NET Core with EF Core migrations and SignalR; its integration tests use SQL Server infrastructure in OutageMap.Server.Tests/Integration/Infrastructure/SqlServerFixture.cs. The client is a Vite-based TypeScript/React application, with map-oriented styling and components under outagemap.client/src/. CI is defined by azure-pipelines.yml.
Main entry points: OutageSyncService.cs Outage sync · useOutageFeed.ts Live outage feed · Program.cs Server composition · OutageReader.cs Outage reader
Components 19
ASP.NET Core server
- Server composition · Registers HTTP, SignalR, hosted sync, and persistence.
OutageMap.Server/Program.cs - Scheduled poller
OutageMap.Server/Services/BackgroundServices/OutagePoller.cs - Outage sync · Fetches, validates, reconciles, and reports source updates.
OutageMap.Server/Services/OutageSyncService.cs - DTO validation and mapping · Validates source DTOs and maps them to outage entities.
OutageMap.Server/Dtos/OutageDto.cs - Outage updater · Applies detected entity changes.
OutageMap.Server/Services/OutageUpdater.cs - Outage database · Stores outage entities and schema configuration.
OutageMap.Server/Models/AppDbContext.cs - Outage reader · Read-side boundary over persisted outages.
OutageMap.Server/Services/OutageReader.cs - GeoJSON projection · Transforms outage entities into map-ready GeoJSON.
OutageMap.Server/Models/OutageEntityToGeojson.cs - Map API · Serves initial and current map data.
OutageMap.Server/Controllers/OutageMapController.cs - Outage hub · Publishes outage changes to connected clients.
OutageMap.Server/Hubs/OutageHub.cs
React map client
- Client bootstrap
outagemap.client/src/main.tsx - Application shell
outagemap.client/src/App.tsx - Live outage feed · Combines initial map data with realtime updates.
outagemap.client/src/hooks/useOutageFeed.ts - SignalR client
outagemap.client/src/lib/outageHub.ts - Outage map · Renders outage features, layers, and interactions.
outagemap.client/src/map/OutageMap.tsx - Selection and popup · Manages selected outages and their detail popup.
outagemap.client/src/hooks/useOutageSelection.ts
Outage sources
- Outage source contract
OutageMap.Server/Infrastructure/Http/IOutageSource.cs - Production feed source
OutageMap.Server/Infrastructure/Http/PollOutageSource.cs - Fixture source
OutageMap.Server/Infrastructure/Http/FixtureOutageService.cs
Connections 21
- Server composition → Scheduled poller: hosts
- Server composition → Map API: exposes
- Server composition → Outage hub: hosts
- Scheduled poller → Outage sync: triggers
- Outage sync → Outage source contract: fetches through
- Production feed source → Outage source contract: implements
- Fixture source → Outage source contract: implements
- Outage sync → DTO validation and mapping: processes DTOs
- DTO validation and mapping → Outage updater: maps valid entities
- Outage updater → Outage database: persists changes
- Outage sync → Outage hub: publishes updates
- Map API → Outage reader: queries
- Outage reader → Outage database: reads
- Outage reader → GeoJSON projection: projects
- Client bootstrap → Application shell: mounts
- Application shell → Live outage feed: uses
- Live outage feed → Map API: loads state
- Live outage feed → SignalR client: subscribes
- SignalR client → Outage hub: connects
- Live outage feed → Outage map: supplies features
- Outage map → Selection and popup: drives selection