Docs/ARCHITECTURE.md

fd34553ab0e63b4d3bc22532b61f4fef32846f34
domain-dig/Docs/ARCHITECTURE.md rendered · source · history · blame · raw

48 lines · 2148 bytes

 1# DomainDig v3.0.0 Architecture
 2
 3## Overview
 4
 5DomainDig is a local-first inspection platform built around one canonical output model: `DomainReport`.
 6
 7Inspection flow:
 8
 91. `DomainInspectionService.inspect(domain:)` gathers live and cached section data into `LookupSnapshot`.
102. `DomainReportBuilder` converts the snapshot into a canonical `DomainReport`.
113. UI, exports, and CLI rendering derive from `DomainReport`.
12
13`LookupSnapshot` remains an internal collection and persistence shape. `DomainReport` is the stable presentation and export contract.
14
15## Canonical Report Lifecycle
16
17- `LookupRuntime` coordinates section services.
18- `DomainInspectionService` normalizes failures, provenance, cache state, and section metadata.
19- `DomainReportBuilder` adds summaries, insights, risk scoring, change analysis, workflow context, and report metadata.
20- `DomainReportExporter` renders TXT, CSV, and JSON from the same report payload.
21- `DomainDigCLI` prints exporter output directly so CLI output matches the app.
22
23## Feature Tiers
24
25The app now uses `FeatureAccessService` as the single feature gating surface.
26
27- `Free`: single lookup, basic history, limited tracking
28- `Pro`: workflows, batch operations, advanced exports
29- `Data+`: future historical datasets and extended enrichment
30
31Current release behavior is static scaffolding only. There are no purchases, backend checks, or remote entitlements.
32
33## Data Boundaries
34
35- Inspection services: network collection only
36- `DomainReportBuilder`: canonical model assembly
37- `FeatureAccessService`: tier and capability checks
38- `DomainViewModel`: UI orchestration, persistence, batch coordination
39- Views: rendering and interaction only
40
41## Adding a New Data Source
42
431. Add the raw collection call to `LookupRuntime`.
442. Integrate it in `DomainInspectionService` with provenance, cache source, and normalized failures.
453. Extend `LookupSnapshot` only if the raw result must persist.
464. Add the summarized representation to `DomainReportBuilder`.
475. Expose it through `DomainReportExporter` if it should appear in TXT, CSV, JSON, or CLI.
486. Render the new summary in SwiftUI using `DomainReport` fields.