How brownbull/archie works
Purpose and Entry Points
Archie is a browser-based architecture-learning and design simulator: users compose system diagrams, inspect compatibility/constraints/economics, simulate demand and failures, and complete scored challenges. The React application boots at src/main.tsx, renders routing/mode selection through src/App.tsx, and is organized around an interactive canvas rather than a conventional server API.
Application Shell and Interaction Surface
The authenticated application shell coordinates workspace layout, toolbox, canvas, inspector, dashboard, and overlays. Canvas authoring uses custom nodes/edges and action controls; the inspector exposes component, connection, configuration, and data-context details.
• src/components/layout/AppLayout.tsx
• src/components/canvas/CanvasView.tsx
• src/components/inspector/InspectorPanel.tsx
Canonical Architecture State
Client-side stores are the primary control boundary. architectureStore owns the editable graph and derived architecture state; specialized stores own challenge session, simulation state, UI state, preferences, saved canvases, and user progression. UI components invoke store actions; calculation services and engines update derived results rather than directly owning UI state.
• src/stores/architectureStore.ts
• src/stores/challengeStore.ts
• src/stores/simulationStore.ts
Reference-Data and Schema Boundary
The simulator is data-driven: YAML component definitions, stacks, blueprints, challenges, and failure scenarios define what can be placed and how it behaves. Repositories load/normalize catalog data, while schemas validate imported and persisted architecture/challenge documents. This separates domain content from interaction and calculation code.
• src/data/components/
• src/repositories/componentRepository.ts
• src/schemas/architectureFileSchema.ts
Evaluation, Recalculation, and Guidance Pipeline
Graph edits flow through recalculation orchestration into pure engine stages: resolve ports and compatibility, validate topology and constraints, propagate demand, calculate dashboard/heatmap metrics, evaluate fit/tier/rubric outcomes, then produce recommendations, ghosts, and pathway guidance. These outputs feed canvas warnings, dashboard scores, and inspector guidance.
• src/services/recalculationService.ts
• src/engine/recalculator.ts
• src/engine/constraintEvaluator.ts
Simulation and Failure Modeling
Simulation is a distinct execution path over the authored architecture. Demand/traffic patterns and selected failures are injected, the simulation engine generates telemetry and outcomes, and simulation state drives playback/stat panels. Failure impact and break detection also support challenge “break it” feedback.
• src/engine/simulationEngine.ts
• src/engine/demandEngine.ts
• src/services/failureImpact.ts
Challenges, Progression, and Persistence
Challenge definitions seed constrained canvases and goals; scoring, attempts, hints, mastery tracks, and chain carry-forward turn the simulator into a progression experience. Persistence hooks/services bridge state to user-specific storage, while YAML import/export is a portable architecture-file boundary.
• src/services/challengeLoader.ts
• src/hooks/useAttemptPersistence.ts
• src/services/yamlImporter.ts
Runtime, Infrastructure, and External Services
The frontend is TypeScript/React built with Vite. Firebase is the material backend integration: authentication and Firestore-backed user/canvas/progress data, with security rules and deployment configuration in-repo. GitHub Actions supplies CI, preview, production, and Playwright E2E workflows. Catalog entries model many third-party technologies, but these are simulated reference data rather than runtime integrations.
• src/lib/firebase.ts
• firebase.json
• .github/workflows/deploy-production.yml
Main entry points: architectureStore.ts Architecture store · challengeStore.ts Challenge store · simulationEngine.ts Simulation engine · AppLayout.tsx Workspace layout
Components 23
Interactive UI
- React bootstrap
src/main.tsx - App routing & modes
src/App.tsx - Workspace layout
src/components/layout/AppLayout.tsx - Diagram canvas · Custom nodes, edges, and authoring controls.
src/components/canvas/CanvasView.tsx - Inspector
src/components/inspector/InspectorPanel.tsx
Client State
- Architecture store · Owns editable and derived architecture state.
src/stores/architectureStore.ts - Challenge store
src/stores/challengeStore.ts - Simulation store
src/stores/simulationStore.ts
Catalog & Evaluation
- Component catalog · Defines placeable components and their behavior.
- Component repository · Loads and normalizes reference definitions.
src/repositories/componentRepository.ts - Architecture schema
src/schemas/architectureFileSchema.ts - Recalculation service
src/services/recalculationService.ts - Evaluation pipeline · Resolves ports, topology, demand, metrics, and guidance.
src/engine/recalculator.ts - Constraint evaluator
src/engine/constraintEvaluator.ts
Simulation & Progression
- Simulation engine · Generates telemetry and outcomes from demand and failures.
src/engine/simulationEngine.ts - Demand engine
src/engine/demandEngine.ts - Failure impact
src/services/failureImpact.ts - Challenge loader
src/services/challengeLoader.ts - Attempt persistence
src/hooks/useAttemptPersistence.ts - YAML import/export
src/services/yamlImporter.ts
Platform
- Firebase · Stores user, canvas, and progress data.
src/lib/firebase.ts - Firebase deployment
firebase.json - Production workflow
.github/workflows/deploy-production.yml
Connections 27
- React bootstrap → App routing & modes: renders
- App routing & modes → Workspace layout: selects workspace
- Workspace layout → Diagram canvas: hosts
- Workspace layout → Inspector: hosts
- Diagram canvas → Architecture store: edits graph
- Inspector → Architecture store: reads and updates
- Architecture store → Recalculation service: graph changes
- Recalculation service → Evaluation pipeline: runs
- Evaluation pipeline → Constraint evaluator: evaluates constraints
- Evaluation pipeline → Architecture store: derived results
- Component repository → Component catalog: loads
- Component repository → Architecture store: supplies definitions
- Architecture schema → Architecture store: validates documents
- Challenge loader → Challenge store: seeds sessions
- Challenge store → Architecture store: applies goals and canvas
- Architecture store → Simulation engine: authored architecture
- Demand engine → Simulation engine: traffic patterns
- Failure impact → Simulation engine: failure inputs
- Simulation engine → Simulation store: telemetry and outcomes
- Simulation store → Diagram canvas: playback overlays
- Failure impact → Challenge store: break feedback
- Attempt persistence → Challenge store: persists attempts
- Attempt persistence → Firebase: stores user progress
- YAML import/export → Architecture schema: validates imports
- YAML import/export → Architecture store: imports and exports
- Firebase deployment → Firebase: deploys hosting
- Production workflow → Firebase deployment: production deploy