# 96ibman/openmacros architecture

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

- Interactive diagram: https://gitdiagram.com/96ibman/openmacros
- Repository: https://github.com/96ibman/openmacros

## Overview

OpenMacros is a locally hosted meal and macro tracker. A user opens the browser UI, which fetches the saved application state and supports maintaining foods, composing recipes, logging intake, configuring targets, and recording weight; the Express server handles those operations against SQLite. The map separates domain capabilities even where they share the same frontend and server files. README descriptions support capabilities whose route details were not sampled, so those links are not inferred beyond the documented client/server and server/storage boundaries.

Main entry points: [`public/app.js`](https://github.com/96ibman/openmacros/blob/main/public/app.js) (App interactions), [`server.js`](https://github.com/96ibman/openmacros/blob/main/server.js) (Food library), [`public/index.html`](https://github.com/96ibman/openmacros/blob/main/public/index.html) (App layout), [`db.js`](https://github.com/96ibman/openmacros/blob/main/db.js) (SQLite access)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_experience["Browser experience"]
  node_page["App layout<br/>[index.html]"]
  node_client["App interactions<br/>[app.js]"]
  node_styles["UI styling<br/>[style.css]"]
end

subgraph group_nutrition["Nutrition management"]
  node_food["Food library<br/>[server.js]"]
  node_ingredients["Ingredients manager<br/>[server.js]"]
  node_recipes["Meal recipes<br/>[server.js]"]
end

subgraph group_tracking["Daily and body tracking"]
  node_intake["Intake logging<br/>[server.js]"]
  node_dashboard["Progress dashboard<br/>[app.js]"]
  node_goals["Goals configuration<br/>[server.js]"]
  node_weight["Weight tracker<br/>[server.js]"]
end

subgraph group_backend["Server and persistence"]
  node_api["HTTP API<br/>[server.js]"]
  node_sqlite["SQLite access<br/>[db.js]"]
  node_store[("Tracker database<br/>[macro_tracker.db]")]
end

node_user(("Tracker user"))

node_user -->|"opens"| node_page
node_page -.->|"hosts"| node_client
node_client -.->|"uses"| node_styles
node_client -->|"fetches state"| node_api
node_client -->|"manages foods"| node_food
node_client -->|"manages ingredients"| node_ingredients
node_client -->|"manages recipes"| node_recipes
node_client -->|"manages logs"| node_intake
node_client -->|"records weight"| node_weight
node_client -.->|"configures goals"| node_goals
node_client -->|"renders"| node_dashboard
node_api -->|"queries"| node_sqlite
node_sqlite -->|"reads and writes"| node_store
node_food -->|"supplies item data"| node_ingredients
node_ingredients -->|"contributes nutrition"| node_recipes
node_food -.->|"recalculates history"| node_intake

click node_page "https://github.com/96ibman/openmacros/blob/main/public/index.html"
click node_client "https://github.com/96ibman/openmacros/blob/main/public/app.js"
click node_styles "https://github.com/96ibman/openmacros/blob/main/public/style.css"
click node_food "https://github.com/96ibman/openmacros/blob/main/server.js"
click node_ingredients "https://github.com/96ibman/openmacros/blob/main/server.js"
click node_recipes "https://github.com/96ibman/openmacros/blob/main/server.js"
click node_intake "https://github.com/96ibman/openmacros/blob/main/server.js"
click node_dashboard "https://github.com/96ibman/openmacros/blob/main/public/app.js"
click node_goals "https://github.com/96ibman/openmacros/blob/main/server.js"
click node_weight "https://github.com/96ibman/openmacros/blob/main/server.js"
click node_api "https://github.com/96ibman/openmacros/blob/main/server.js"
click node_sqlite "https://github.com/96ibman/openmacros/blob/main/db.js"
click node_store "https://github.com/96ibman/openmacros/blob/main/macro_tracker.db"

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_page,node_client,node_styles,node_user toneBlue
class node_food,node_ingredients,node_recipes toneAmber
class node_intake,node_dashboard,node_goals,node_weight toneMint
class node_api,node_sqlite,node_store toneRose
```

## Components

### Browser experience

- [App layout](https://github.com/96ibman/openmacros/blob/main/public/index.html): `public/index.html`
- [App interactions](https://github.com/96ibman/openmacros/blob/main/public/app.js): `public/app.js`
- [UI styling](https://github.com/96ibman/openmacros/blob/main/public/style.css): `public/style.css`

### Nutrition management

- [Food library](https://github.com/96ibman/openmacros/blob/main/server.js): `server.js`
- [Ingredients manager](https://github.com/96ibman/openmacros/blob/main/server.js): `server.js`
- [Meal recipes](https://github.com/96ibman/openmacros/blob/main/server.js): `server.js`

### Daily and body tracking

- [Intake logging](https://github.com/96ibman/openmacros/blob/main/server.js): `server.js`
- [Progress dashboard](https://github.com/96ibman/openmacros/blob/main/public/app.js): `public/app.js`
- [Goals configuration](https://github.com/96ibman/openmacros/blob/main/server.js): `server.js`
- [Weight tracker](https://github.com/96ibman/openmacros/blob/main/server.js): `server.js`

### Server and persistence

- [HTTP API](https://github.com/96ibman/openmacros/blob/main/server.js): `server.js`
- [SQLite access](https://github.com/96ibman/openmacros/blob/main/db.js): `db.js`
- [Tracker database](https://github.com/96ibman/openmacros/blob/main/macro_tracker.db): `macro_tracker.db`

### Other components

- **Tracker user**

## Connections

- Tracker user → App layout: opens (evidence: `README.md`)
- App layout → App interactions: hosts
- App interactions → UI styling: uses
- App interactions → HTTP API: fetches state (evidence: `public/app.js`)
- App interactions → Food library: manages foods (evidence: `public/app.js`)
- App interactions → Ingredients manager: manages ingredients (evidence: `public/app.js`)
- App interactions → Meal recipes: manages recipes (evidence: `public/app.js`)
- App interactions → Intake logging: manages logs (evidence: `public/app.js`)
- App interactions → Weight tracker: records weight (evidence: `public/app.js`)
- App interactions → Goals configuration: configures goals (evidence: `README.md`)
- App interactions → Progress dashboard: renders (evidence: `public/app.js`)
- HTTP API → SQLite access: queries (evidence: `server.js`)
- SQLite access → Tracker database: reads and writes (evidence: `db.js`)
- Food library → Ingredients manager: supplies item data (evidence: `server.js`)
- Ingredients manager → Meal recipes: contributes nutrition (evidence: `server.js`)
- Food library → Intake logging: recalculates history (evidence: `README.md`)
