# tjnutricost/nc-inventory-tracker architecture

> Architecture diagram of the GitHub repository tjnutricost/nc-inventory-tracker, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-10-02). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/tjnutricost/nc-inventory-tracker
- Repository: https://github.com/tjnutricost/nc-inventory-tracker

## Overview

Nutricost IT Assets is a mobile-first asset inventory and employee self-service app. Employees or IT sign in, find or scan equipment, then check it out, return it, or request equipment/returns; IT also manages assets, people, licenses, catalog entries, and operational dashboards. The Express server owns API workflows and coordinates assignment, request, catalog, persistence, and email behavior. The browser client provides the responsive interface and scanning experience. Source excerpts do not show all route-to-module calls, so undocumented links are omitted.

Main entry points: [`src/server.js`](https://github.com/tjnutricost/nc-inventory-tracker/blob/stage/src/server.js) (HTTP API), [`public/app.js`](https://github.com/tjnutricost/nc-inventory-tracker/blob/stage/public/app.js) (App interface), [`src/mailer.js`](https://github.com/tjnutricost/nc-inventory-tracker/blob/stage/src/mailer.js) (Email notifications), [`src/db.js`](https://github.com/tjnutricost/nc-inventory-tracker/blob/stage/src/db.js) (SQLite inventory)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_client["Web client"]
  node_web["App interface<br/>[app.js]"]
  node_scan["Barcode scanning<br/>[app.js]"]
end

subgraph group_server["Application server"]
  node_server["HTTP API<br/>[server.js]"]
  node_people["People and access<br/>[server.js]"]
  node_dashboard["Dashboard and activity<br/>[server.js]"]
  node_assets["Asset management<br/>[server.js]"]
end

subgraph group_domain["Inventory workflows"]
  node_assignment["Checkout and check-in<br/>[assignments.js]"]
  node_requests["Equipment and returns<br/>[requests.js]"]
  node_catalog["Equipment catalog<br/>[catalog.js]"]
  node_serial["Serial matching<br/>[serial.js]"]
end

subgraph group_persistence["Data and messaging"]
  node_database[("SQLite inventory<br/>[db.js]")]
  node_schema["Schema migrations<br/>[migrations.js]"]
  node_runner["Migration runner<br/>[migrate.js]"]
  node_mail["Email notifications<br/>[mailer.js]"]
end

node_employee(("Employee"))
node_it(("IT admin"))
node_workspace["SMTP service"]

node_employee -->|"uses"| node_web
node_it -->|"uses"| node_web
node_web -.->|"calls API"| node_server
node_web -->|"starts scan"| node_scan
node_server -->|"routes"| node_people
node_server -->|"routes"| node_assets
node_server -.->|"routes"| node_dashboard
node_server -->|"delegates"| node_assignment
node_server -->|"delegates"| node_requests
node_server -->|"delegates"| node_catalog
node_server -->|"uses"| node_serial
node_server -->|"reads/writes"| node_database
node_database -->|"runs"| node_runner
node_runner -->|"applies"| node_schema
node_server -.->|"notifies"| node_mail
node_mail -->|"logs outbox"| node_database
node_mail -.->|"sends mail"| node_workspace

click node_web "https://github.com/tjnutricost/nc-inventory-tracker/blob/stage/public/app.js"
click node_scan "https://github.com/tjnutricost/nc-inventory-tracker/blob/stage/public/app.js"
click node_server "https://github.com/tjnutricost/nc-inventory-tracker/blob/stage/src/server.js"
click node_people "https://github.com/tjnutricost/nc-inventory-tracker/blob/stage/src/server.js"
click node_dashboard "https://github.com/tjnutricost/nc-inventory-tracker/blob/stage/src/server.js"
click node_assets "https://github.com/tjnutricost/nc-inventory-tracker/blob/stage/src/server.js"
click node_assignment "https://github.com/tjnutricost/nc-inventory-tracker/blob/stage/src/assignments.js"
click node_requests "https://github.com/tjnutricost/nc-inventory-tracker/blob/stage/src/requests.js"
click node_catalog "https://github.com/tjnutricost/nc-inventory-tracker/blob/stage/src/catalog.js"
click node_serial "https://github.com/tjnutricost/nc-inventory-tracker/blob/stage/src/serial.js"
click node_database "https://github.com/tjnutricost/nc-inventory-tracker/blob/stage/src/db.js"
click node_schema "https://github.com/tjnutricost/nc-inventory-tracker/blob/stage/src/migrations.js"
click node_runner "https://github.com/tjnutricost/nc-inventory-tracker/blob/stage/src/migrate.js"
click node_mail "https://github.com/tjnutricost/nc-inventory-tracker/blob/stage/src/mailer.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_web,node_scan toneBlue
class node_server,node_people,node_dashboard,node_assets toneAmber
class node_assignment,node_requests,node_catalog,node_serial toneMint
class node_database,node_schema,node_runner,node_mail toneRose
class node_employee,node_it,node_workspace toneIndigo
```

## Components

### Web client

- [App interface](https://github.com/tjnutricost/nc-inventory-tracker/blob/stage/public/app.js): `public/app.js`
- [Barcode scanning](https://github.com/tjnutricost/nc-inventory-tracker/blob/stage/public/app.js): `public/app.js`

### Application server

- [HTTP API](https://github.com/tjnutricost/nc-inventory-tracker/blob/stage/src/server.js): `src/server.js`
- [People and access](https://github.com/tjnutricost/nc-inventory-tracker/blob/stage/src/server.js): `src/server.js`
- [Dashboard and activity](https://github.com/tjnutricost/nc-inventory-tracker/blob/stage/src/server.js): `src/server.js`
- [Asset management](https://github.com/tjnutricost/nc-inventory-tracker/blob/stage/src/server.js): `src/server.js`

### Inventory workflows

- [Checkout and check-in](https://github.com/tjnutricost/nc-inventory-tracker/blob/stage/src/assignments.js): `src/assignments.js`
- [Equipment and returns](https://github.com/tjnutricost/nc-inventory-tracker/blob/stage/src/requests.js): `src/requests.js`
- [Equipment catalog](https://github.com/tjnutricost/nc-inventory-tracker/blob/stage/src/catalog.js): `src/catalog.js`
- [Serial matching](https://github.com/tjnutricost/nc-inventory-tracker/blob/stage/src/serial.js): `src/serial.js`

### Data and messaging

- [SQLite inventory](https://github.com/tjnutricost/nc-inventory-tracker/blob/stage/src/db.js): `src/db.js`
- [Schema migrations](https://github.com/tjnutricost/nc-inventory-tracker/blob/stage/src/migrations.js): `src/migrations.js`
- [Migration runner](https://github.com/tjnutricost/nc-inventory-tracker/blob/stage/src/migrate.js): `src/migrate.js`
- [Email notifications](https://github.com/tjnutricost/nc-inventory-tracker/blob/stage/src/mailer.js): `src/mailer.js`

### Other components

- **Employee**
- **IT admin**
- **SMTP service**

## Connections

- Employee → App interface: uses (evidence: `README.md`)
- IT admin → App interface: uses (evidence: `README.md`)
- App interface → HTTP API: calls API
- App interface → Barcode scanning: starts scan (evidence: `README.md`)
- HTTP API → People and access: routes (evidence: `src/server.js`)
- HTTP API → Asset management: routes (evidence: `src/server.js`)
- HTTP API → Dashboard and activity: routes (evidence: `src/server.js`)
- HTTP API → Checkout and check-in: delegates (evidence: `src/server.js`)
- HTTP API → Equipment and returns: delegates (evidence: `src/server.js`)
- HTTP API → Equipment catalog: delegates (evidence: `src/server.js`)
- HTTP API → Serial matching: uses (evidence: `src/server.js`)
- HTTP API → SQLite inventory: reads/writes (evidence: `src/db.js`)
- SQLite inventory → Migration runner: runs (evidence: `src/db.js`)
- Migration runner → Schema migrations: applies (evidence: `src/db.js`)
- HTTP API → Email notifications: notifies (evidence: `src/server.js`)
- Email notifications → SQLite inventory: logs outbox (evidence: `src/mailer.js`)
- Email notifications → SMTP service: sends mail
