# diegochavez/burger-builder-mobx-state-tree architecture

> Architecture diagram of the GitHub repository diegochavez/burger-builder-mobx-state-tree, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-03-31). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/diegochavez/burger-builder-mobx-state-tree
- Repository: https://github.com/diegochavez/burger-builder-mobx-state-tree

## Overview

1. **Project type and purpose**
   - This is a small **React + TypeScript demo app** for building a burger visually.
   - The README makes the intent explicit: it is a presentation app showcasing **MobX-State-Tree (MST)** and its benefits, not a full backend-driven product.

2. **Top-level structure**
   - The repository is split into three main areas:
     - `src/` for application logic and UI
     - `public/` for static assets and the HTML host page
     - root config files for TypeScript, npm, and sandbox setup

3. **Application bootstrap**
   - `src/index.tsx` is the entry point that mounts the React app.
   - `src/components/App.tsx` is the top-level UI component.
   - `src/withRoot.tsx` likely wraps the app with shared providers/theme setup, acting as a composition boundary between the entry point and the component tree.

4. **State management boundary**
   - `src/stores/RootStore.tsx` is the central state container for the app.
   - This is the main architectural boundary between UI and state: components consume store state and actions rather than managing the burger data locally.
   - The use of MobX-State-Tree implies state is modeled as observable, structured application state with actions/mutations handled through the store layer.

5. **Domain model layer**
   - `src/stores/models/Burger.tsx` and `src/stores/models/Ingredient.tsx` define the core domain objects.
   - The burger builder is modeled around at least two concepts:
     - a **Burger** aggregate/root
     - individual **Ingredient** items
   - This model layer is the source of truth for what can be added, removed, or displayed in the burger.

6. **UI composition**
   - `src/components/Burger.tsx` and `src/components/Ingredient.tsx` are the primary visual components for the domain.
   - `Burger` likely renders the assembled burger from store state.
   - `Ingredient` likely renders one ingredient item, either as a selectable option or as a part of the assembled burger view.
   - `App.tsx` probably composes these components and wires them to store data/actions.

7. **Data flow**
   - The likely flow is:
     - store initializes domain state in `RootStore`
     - UI reads observable state from the store
     - user interaction in components triggers store actions
     - the store updates burger/ingredient state
     - React re-renders the visual burger from the updated state
   - This makes the app a classic **unidirectional state-driven UI**, with MST handling the state transition logic.

8. **Static assets**
   - `public/images/burger-assets` contains image assets for burger ingredients and related visuals.
   - These assets are part of the presentation layer and are likely referenced by the ingredient/burger components to render the assembled burger.

9. **Runtime and tooling**
   - The stack is **React**, **TypeScript**, and **MobX-State-Tree**.
   - `package.json` / `package-lock.json` define the npm-based build/runtime dependencies.
   - `tsconfig.json` indicates TypeScript compilation and type checking are central to the codebase.
   - `sandbox.config.json` suggests the app is intended to run in a sandbox/demo environment as well as locally.

10. **Architecture boundaries to draw**
   - A good diagram should show:
     - **Entry/bootstrapping**: `index.tsx` → `withRoot`
     - **Composition/UI layer**: `App` → `Burger` / `Ingredient`
     - **State layer**: `RootStore` → domain models `Burger` and `Ingredient`
     - **Assets layer**: `public/images/burger-assets` feeding UI rendering
   - The key separation is between **presentational components** and **MST-backed state/domain models**.

11. **Notable absence**
   - There is no evidence of a backend, API client, router, or persistence layer in the file tree.
   - The app appears self-contained and client-side only, with all interactive state managed in the frontend store.

Main entry points: [`src/components/App.tsx`](https://github.com/diegochavez/burger-builder-mobx-state-tree/blob/master/src/components/App.tsx) (App), [`src/index.tsx`](https://github.com/diegochavez/burger-builder-mobx-state-tree/blob/master/src/index.tsx) (Entry), [`src/stores/RootStore.tsx`](https://github.com/diegochavez/burger-builder-mobx-state-tree/blob/master/src/stores/RootStore.tsx) (RootStore), [`src/stores/models/Burger.tsx`](https://github.com/diegochavez/burger-builder-mobx-state-tree/blob/master/src/stores/models/Burger.tsx) (Burger model)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_root["Root"]
  node_readme["README<br/>docs<br/>[README.md]"]
  node_package["package<br/>npm manifest<br/>[package.json]"]
  node_tsconfig["tsconfig<br/>TypeScript config<br/>[tsconfig.json]"]
  node_sandbox["sandbox<br/>demo config"]
  node_reactenv["React env<br/>type defs<br/>[react-app-env.d.ts]"]
end

subgraph group_runtime["Runtime"]
  node_host["Host page<br/>html shell<br/>[index.html]"]
  node_entry["Entry<br/>React bootstrap<br/>[index.tsx]"]
end

subgraph group_ui["UI"]
  node_rootwrap["Root wrapper<br/>composition boundary<br/>[withRoot.tsx]"]
  node_app["App<br/>top-level view<br/>[App.tsx]"]
  node_burgerview["Burger<br/>domain view<br/>[Burger.tsx]"]
  node_ingview["Ingredient<br/>item view<br/>[Ingredient.tsx]"]
end

subgraph group_state["State"]
  node_rootstore[("RootStore<br/>MST store<br/>[RootStore.tsx]")]
  node_burgermodel{{"Burger model<br/>domain model<br/>[Burger.tsx]"}}
  node_ingmodel{{"Ingredient model<br/>domain model<br/>[Ingredient.tsx]"}}
end

subgraph group_assets["Assets"]
  node_burgerassets["Burger assets<br/>static images"]
end

node_host -->|"loads"| node_entry
node_entry -->|"boots"| node_rootwrap
node_rootwrap -->|"renders"| node_app
node_app -->|"composes"| node_burgerview
node_app -->|"composes"| node_ingview
node_app -->|"binds"| node_rootstore
node_burgerview -->|"uses"| node_burgerassets
node_ingview -->|"uses"| node_burgerassets
node_rootstore -->|"owns"| node_burgermodel
node_rootstore -->|"owns"| node_ingmodel
node_burgermodel -->|"contains"| node_ingmodel
node_app -->|"reads"| node_burgermodel
node_app -->|"reads"| node_ingmodel
node_package -->|"builds"| node_entry
node_tsconfig -->|"types"| node_entry
node_sandbox -->|"hosts"| node_host
node_reactenv -.->|"types"| node_app

click node_readme "https://github.com/diegochavez/burger-builder-mobx-state-tree/blob/master/README.md"
click node_package "https://github.com/diegochavez/burger-builder-mobx-state-tree/blob/master/package.json"
click node_tsconfig "https://github.com/diegochavez/burger-builder-mobx-state-tree/blob/master/tsconfig.json"
click node_sandbox "https://github.com/diegochavez/burger-builder-mobx-state-tree/blob/master/sandbox.config.json"
click node_host "https://github.com/diegochavez/burger-builder-mobx-state-tree/blob/master/public/index.html"
click node_entry "https://github.com/diegochavez/burger-builder-mobx-state-tree/blob/master/src/index.tsx"
click node_rootwrap "https://github.com/diegochavez/burger-builder-mobx-state-tree/blob/master/src/withRoot.tsx"
click node_app "https://github.com/diegochavez/burger-builder-mobx-state-tree/blob/master/src/components/App.tsx"
click node_burgerview "https://github.com/diegochavez/burger-builder-mobx-state-tree/blob/master/src/components/Burger.tsx"
click node_ingview "https://github.com/diegochavez/burger-builder-mobx-state-tree/blob/master/src/components/Ingredient.tsx"
click node_rootstore "https://github.com/diegochavez/burger-builder-mobx-state-tree/blob/master/src/stores/RootStore.tsx"
click node_burgermodel "https://github.com/diegochavez/burger-builder-mobx-state-tree/blob/master/src/stores/models/Burger.tsx"
click node_ingmodel "https://github.com/diegochavez/burger-builder-mobx-state-tree/blob/master/src/stores/models/Ingredient.tsx"
click node_burgerassets "https://github.com/diegochavez/burger-builder-mobx-state-tree/tree/master/public/images/burger-assets"
click node_reactenv "https://github.com/diegochavez/burger-builder-mobx-state-tree/blob/master/src/react-app-env.d.ts"

classDef toneNeutral fill:#f8fafc,stroke:#334155,stroke-width:1.5px,color:#0f172a
classDef toneBlue fill:#dbeafe,stroke:#2563eb,stroke-width:1.5px,color:#172554
classDef toneAmber fill:#fef3c7,stroke:#d97706,stroke-width:1.5px,color:#78350f
classDef toneMint fill:#dcfce7,stroke:#16a34a,stroke-width:1.5px,color:#14532d
classDef toneRose fill:#ffe4e6,stroke:#e11d48,stroke-width:1.5px,color:#881337
classDef toneIndigo fill:#e0e7ff,stroke:#4f46e5,stroke-width:1.5px,color:#312e81
classDef toneTeal fill:#ccfbf1,stroke:#0f766e,stroke-width:1.5px,color:#134e4a
class node_readme,node_package,node_tsconfig,node_sandbox,node_reactenv toneBlue
class node_host,node_entry toneAmber
class node_rootwrap,node_app,node_burgerview,node_ingview toneMint
class node_rootstore,node_burgermodel,node_ingmodel toneRose
class node_burgerassets toneIndigo
```

## Components

### Root

Repository-level docs and tooling

- [README](https://github.com/diegochavez/burger-builder-mobx-state-tree/blob/master/README.md): docs · Project overview and MST demo intent · `README.md`
- [package](https://github.com/diegochavez/burger-builder-mobx-state-tree/blob/master/package.json): npm manifest · Dependencies and scripts · `package.json`
- [tsconfig](https://github.com/diegochavez/burger-builder-mobx-state-tree/blob/master/tsconfig.json): TypeScript config · TypeScript compiler settings · `tsconfig.json`
- [sandbox](https://github.com/diegochavez/burger-builder-mobx-state-tree/blob/master/sandbox.config.json): demo config · Sandbox/runtime setup · `sandbox.config.json`
- [React env](https://github.com/diegochavez/burger-builder-mobx-state-tree/blob/master/src/react-app-env.d.ts): type defs · CRA environment typings · `src/react-app-env.d.ts`

### Runtime

HTML host and app bootstrap

- [Host page](https://github.com/diegochavez/burger-builder-mobx-state-tree/blob/master/public/index.html): html shell · Browser entry HTML · `public/index.html`
- [Entry](https://github.com/diegochavez/burger-builder-mobx-state-tree/blob/master/src/index.tsx): React bootstrap · Mounts the application · `src/index.tsx`

### UI

React components and composition

- [Root wrapper](https://github.com/diegochavez/burger-builder-mobx-state-tree/blob/master/src/withRoot.tsx): composition boundary · Shared providers or app-level setup · `src/withRoot.tsx`
- [App](https://github.com/diegochavez/burger-builder-mobx-state-tree/blob/master/src/components/App.tsx): top-level view · Main application composition · `src/components/App.tsx`
- [Burger](https://github.com/diegochavez/burger-builder-mobx-state-tree/blob/master/src/components/Burger.tsx): domain view · Renders the assembled burger · `src/components/Burger.tsx`
- [Ingredient](https://github.com/diegochavez/burger-builder-mobx-state-tree/blob/master/src/components/Ingredient.tsx): item view · Renders ingredient visuals · `src/components/Ingredient.tsx`

### State

MST store and domain models

- [RootStore](https://github.com/diegochavez/burger-builder-mobx-state-tree/blob/master/src/stores/RootStore.tsx): MST store · Central application state container · `src/stores/RootStore.tsx`
- [Burger model](https://github.com/diegochavez/burger-builder-mobx-state-tree/blob/master/src/stores/models/Burger.tsx): domain model · Burger aggregate and state logic · `src/stores/models/Burger.tsx`
- [Ingredient model](https://github.com/diegochavez/burger-builder-mobx-state-tree/blob/master/src/stores/models/Ingredient.tsx): domain model · Ingredient data and behavior · `src/stores/models/Ingredient.tsx`

### Assets

Static presentation assets

- [Burger assets](https://github.com/diegochavez/burger-builder-mobx-state-tree/tree/master/public/images/burger-assets): static images · Ingredient and burger image assets · `public/images/burger-assets`

## Connections

- Host page → Entry: loads · Browser host loads the React entry point
- Entry → Root wrapper: boots · Entry point composes the root wrapper
- Root wrapper → App: renders · Root wrapper provides shared setup to App
- App → Burger: composes · Main view includes the burger display
- App → Ingredient: composes · Main view includes ingredient UI
- App → RootStore: binds · App consumes central observable state
- Burger → Burger assets: uses · Burger visuals are driven by static assets
- Ingredient → Burger assets: uses · Ingredient visuals use image assets
- RootStore → Burger model: owns · Root store coordinates burger domain state
- RootStore → Ingredient model: owns · Root store coordinates ingredient domain state
- Burger model → Ingredient model: contains · Burger state is built from ingredient items
- App → Burger model: reads · UI reflects burger model state
- App → Ingredient model: reads · UI reflects ingredient model state
- package → Entry: builds · NPM tooling compiles and runs the app
- tsconfig → Entry: types · TypeScript config governs source compilation
- sandbox → Host page: hosts · Sandbox setup points at the browser shell
- React env → App: types · React environment typings support the UI code
