Architecture
Layers, the dependency rule, non-negotiable principles and the shared app shape.
LayersLink to this section: Layers
From top to bottom: product domain, ecosystem and AI, one product-line layer, then the kernel and design system. Firebase adapters bind at the composition root.
Product domain layer
Vertical features only, under lib/features/<vertical>/ in each product repo: garage, patients, flights. Never in shared packages.
Ecosystem layer
After ID, After+, the event bus, cross-product APIs and shared services. Products talk to each other through this fabric — never through sibling imports.
AI capabilities
One AI platform with modular capabilities — conversation, OCR, vision, summarization, tool calling and more. Products enable or disable; they do not ship private AI stacks.
Consumer modules
Thin B2C layer: membership bridge, consumer feature catalog, personal vault, launch consent and regional location. Reference: SuperGarage.
Enterprise modules
Fourteen B2B ports — organization, RBAC, workflow, tasks, calendar, documents, messaging, reporting, audit, offline sync — each with an in-memory mock. Reference: SuperHospital.
Shared kernel
Auth, hardened networking, storage, Riverpod DI, flags, remote config, BYOK AI SDK, premium entitlements, notifications, deep links, and the dashboard, plugin, search and settings engines.
Design system
One visual family for consumer and enterprise: color, spacing, radius, motion and typography tokens, plus shared components.
Firebase adapters
Firebase Auth, Firestore blob sync and Storage media sync behind after_core ports. Bound at the composition root only; domain code never imports Firebase.
Dependency ruleLink to this section: Dependency rule
Dependencies point downward only. Products communicate with each other through events and secure APIs in the ecosystem layer. Adding a domain adds a top-layer module and leaves this diagram unchanged.
PrinciplesLink to this section: Principles
- SuperGarage is the consumer reference; SuperHospital is the enterprise reference.
- Industry and vertical modules live only in product repos.
- Shared OS modules live only in after_core, after_consumer and after_enterprise.
- Generate, don't greenfield.
- Ports over SDKs.
- Family feel wins: chrome, motion, density, splash and shell are identical.
- Every port ships with a mock implementation.
Shared app shapeLink to this section: Shared app shape
Every product, consumer or enterprise, boots through the same sequence.
main.dart
→ PlatformConfig.current = manifest
→ ProviderScope(overrides: After*Overrides…)
→ ColdStart (OVERSTEIN splash)
→ AuthGate
→ ProductShell (tabs from platform + spec)
→ Home = Dashboard Engine (+ plugins)
→ OS modules = platform screens
→ Vertical = product feature modules onlySource supercore/docs/PLATFORM_DOCTRINE.md (opens in a new tab)