# ztrebo14/kabarako-shop architecture

> Architecture diagram of the GitHub repository ztrebo14/kabarako-shop, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-11-17). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/ztrebo14/kabarako-shop
- Repository: https://github.com/ztrebo14/kabarako-shop

## Overview

Kabarako Shop is a coffee-inventory management app. A shop operator uses the React interface to view and sort coffee items, add or edit item details, delete entries, and order stock. The routed pages call shared item state, which loads and writes the coffeeList collection in Firestore; ordering updates stock transactionally. The client also initializes Firebase Analytics and Auth, while server/index.js independently initializes Firebase and observes auth state. The README is empty, so capabilities and relationships here are based on the supplied source excerpts; no server-to-client API is shown.

Main entry points: [`client/src/router/App.jsx`](https://github.com/ztrebo14/kabarako-shop/blob/main/client/src/router/App.jsx) (Routes and provider), [`client/src/contexts/ItemContext.jsx`](https://github.com/ztrebo14/kabarako-shop/blob/main/client/src/contexts/ItemContext.jsx) (Item operations), [`client/src/pages/DisplayItem.jsx`](https://github.com/ztrebo14/kabarako-shop/blob/main/client/src/pages/DisplayItem.jsx) (Browse and order), [`client/src/router/Root.jsx`](https://github.com/ztrebo14/kabarako-shop/blob/main/client/src/router/Root.jsx) (Root layout)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_ui["React application"]
  node_entry["React entry<br/>[main.jsx]"]
  node_router["Routes and provider<br/>[App.jsx]"]
  node_root["Root layout<br/>[Root.jsx]"]
  node_navbar["Navigation<br/>[NavBar.jsx]"]
end

subgraph group_catalog["Item workflows"]
  node_catalog_view["Browse and order<br/>[DisplayItem.jsx]"]
  node_add_item["Add coffee<br/>[AddItem.jsx]"]
  node_edit_item["Edit coffee<br/>[EditItem.jsx]"]
  node_dashboard["Dashboard page<br/>[Dashboard.jsx]"]
end

subgraph group_state["Inventory state"]
  node_item_state["Item operations<br/>[ItemContext.jsx]"]
end

subgraph group_cloud["Firebase services"]
  node_client_firebase["Client Firebase setup<br/>[firebase.js]"]
  node_server_firebase["Server Firebase setup<br/>[index.js]"]
  node_firestore[("Firestore")]
end

node_operator(("Shop operator"))
node_firebase_platform["Firebase platform"]

node_operator -->|"uses"| node_entry
node_entry -->|"renders"| node_router
node_router -->|"routes to"| node_root
node_router -->|"routes to"| node_catalog_view
node_router -->|"routes to"| node_add_item
node_router -->|"routes to"| node_edit_item
node_root -->|"renders"| node_navbar
node_root -->|"outlet renders"| node_catalog_view
node_catalog_view -->|"uses item operations"| node_item_state
node_add_item -->|"adds item"| node_item_state
node_edit_item -->|"edits item"| node_item_state
node_item_state -->|"uses database setup"| node_client_firebase
node_client_firebase -->|"initializes"| node_firestore
node_item_state -->|"reads and writes"| node_firestore
node_client_firebase -->|"initializes services"| node_firebase_platform
node_server_firebase -->|"initializes services"| node_firebase_platform
node_navbar -.->|"links toward"| node_catalog_view
node_navbar -->|"links toward"| node_add_item

click node_entry "https://github.com/ztrebo14/kabarako-shop/blob/main/client/src/main.jsx"
click node_router "https://github.com/ztrebo14/kabarako-shop/blob/main/client/src/router/App.jsx"
click node_root "https://github.com/ztrebo14/kabarako-shop/blob/main/client/src/router/Root.jsx"
click node_navbar "https://github.com/ztrebo14/kabarako-shop/blob/main/client/src/components/NavBar.jsx"
click node_catalog_view "https://github.com/ztrebo14/kabarako-shop/blob/main/client/src/pages/DisplayItem.jsx"
click node_add_item "https://github.com/ztrebo14/kabarako-shop/blob/main/client/src/pages/AddItem.jsx"
click node_edit_item "https://github.com/ztrebo14/kabarako-shop/blob/main/client/src/pages/EditItem.jsx"
click node_dashboard "https://github.com/ztrebo14/kabarako-shop/blob/main/client/src/pages/Dashboard.jsx"
click node_item_state "https://github.com/ztrebo14/kabarako-shop/blob/main/client/src/contexts/ItemContext.jsx"
click node_client_firebase "https://github.com/ztrebo14/kabarako-shop/blob/main/client/src/firebase.js"
click node_server_firebase "https://github.com/ztrebo14/kabarako-shop/blob/main/server/index.js"

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_entry,node_router,node_root,node_navbar toneBlue
class node_catalog_view,node_add_item,node_edit_item,node_dashboard toneAmber
class node_item_state toneMint
class node_client_firebase,node_server_firebase,node_firestore toneRose
class node_operator,node_firebase_platform toneIndigo
```

## Components

### React application

- [React entry](https://github.com/ztrebo14/kabarako-shop/blob/main/client/src/main.jsx): `client/src/main.jsx`
- [Routes and provider](https://github.com/ztrebo14/kabarako-shop/blob/main/client/src/router/App.jsx): `client/src/router/App.jsx`
- [Root layout](https://github.com/ztrebo14/kabarako-shop/blob/main/client/src/router/Root.jsx): `client/src/router/Root.jsx`
- [Navigation](https://github.com/ztrebo14/kabarako-shop/blob/main/client/src/components/NavBar.jsx): `client/src/components/NavBar.jsx`

### Item workflows

- [Browse and order](https://github.com/ztrebo14/kabarako-shop/blob/main/client/src/pages/DisplayItem.jsx): `client/src/pages/DisplayItem.jsx`
- [Add coffee](https://github.com/ztrebo14/kabarako-shop/blob/main/client/src/pages/AddItem.jsx): `client/src/pages/AddItem.jsx`
- [Edit coffee](https://github.com/ztrebo14/kabarako-shop/blob/main/client/src/pages/EditItem.jsx): `client/src/pages/EditItem.jsx`
- [Dashboard page](https://github.com/ztrebo14/kabarako-shop/blob/main/client/src/pages/Dashboard.jsx): `client/src/pages/Dashboard.jsx`

### Inventory state

- [Item operations](https://github.com/ztrebo14/kabarako-shop/blob/main/client/src/contexts/ItemContext.jsx): `client/src/contexts/ItemContext.jsx`

### Firebase services

- [Client Firebase setup](https://github.com/ztrebo14/kabarako-shop/blob/main/client/src/firebase.js): `client/src/firebase.js`
- [Server Firebase setup](https://github.com/ztrebo14/kabarako-shop/blob/main/server/index.js): `server/index.js`
- **Firestore**

### Other components

- **Shop operator**
- **Firebase platform**

## Connections

- Shop operator → React entry: uses
- React entry → Routes and provider: renders (evidence: `client/src/main.jsx`)
- Routes and provider → Root layout: routes to (evidence: `client/src/router/App.jsx`)
- Routes and provider → Browse and order: routes to (evidence: `client/src/router/App.jsx`)
- Routes and provider → Add coffee: routes to (evidence: `client/src/router/App.jsx`)
- Routes and provider → Edit coffee: routes to (evidence: `client/src/router/App.jsx`)
- Root layout → Navigation: renders (evidence: `client/src/router/Root.jsx`)
- Root layout → Browse and order: outlet renders (evidence: `client/src/router/Root.jsx`)
- Browse and order → Item operations: uses item operations (evidence: `client/src/pages/DisplayItem.jsx`)
- Add coffee → Item operations: adds item (evidence: `client/src/pages/AddItem.jsx`)
- Edit coffee → Item operations: edits item (evidence: `client/src/pages/EditItem.jsx`)
- Item operations → Client Firebase setup: uses database setup (evidence: `client/src/contexts/ItemContext.jsx`)
- Client Firebase setup → Firestore: initializes (evidence: `client/src/firebase.js`)
- Item operations → Firestore: reads and writes (evidence: `client/src/contexts/ItemContext.jsx`)
- Client Firebase setup → Firebase platform: initializes services (evidence: `client/src/firebase.js`)
- Server Firebase setup → Firebase platform: initializes services (evidence: `server/index.js`)
- Navigation → Browse and order: links toward
- Navigation → Add coffee: links toward (evidence: `client/src/components/NavBar.jsx`)
