# baptchau/gmq architecture

> Architecture diagram of the GitHub repository baptchau/gmq, 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/baptchau/gmq
- Repository: https://github.com/baptchau/gmq

## Overview

Suivi GMQ is a farm application for managing young cattle, recording live or carcass weigh-ins, and tracking average daily gain (GMQ). An operator signs in, registers animals and optional mothers, adds weigh-ins, then views animal history and calculated growth. Vue components use a shared HTTP client to reach the Express API; the API enforces account-scoped access and uses SQLite for records and GMQ calculations. Carcass weights are converted to estimated live weights using the applicable yield. The route handlers are grouped by domain despite sharing one server file; links reflect shown calls or README-documented API access.

Main entry points: [`frontend/src/api.js`](https://github.com/baptchau/gmq/blob/master/frontend/src/api.js) (API client), [`frontend/src/App.vue`](https://github.com/baptchau/gmq/blob/master/frontend/src/App.vue) (Session and dashboard), [`backend/src/server.js`](https://github.com/baptchau/gmq/blob/master/backend/src/server.js) (Herd routes), [`backend/src/db.js`](https://github.com/baptchau/gmq/blob/master/backend/src/db.js) (SQLite records)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_frontend["Farm interface"]
  node_app["Session and dashboard<br/>[App.vue]"]
  node_login["Account access<br/>[Login.vue]"]
  node_animal_form["Animal registration<br/>[BroutardForm.vue]"]
  node_mother_manager["Mother records<br/>[MereManager.vue]"]
  node_animal_detail["Animal and weigh-ins<br/>[BroutardDetail.vue]"]
  node_http_client["API client<br/>[api.js]"]
end

subgraph group_backend["API and domain"]
  node_auth_routes["Account routes<br/>[server.js]"]
  node_herd_routes["Herd routes<br/>[server.js]"]
  node_weigh_routes["Weigh-in routes<br/>[server.js]"]
  node_auth_security["JWT and passwords<br/>[auth.js]"]
  node_gmq["Yield and GMQ<br/>[db.js]"]
end

subgraph group_persistence["Data storage"]
  node_sqlite[("SQLite records<br/>[db.js]")]
end

node_operator(("Farm operator"))

node_operator -->|"signs in"| node_login
node_login -->|"requests account"| node_http_client
node_app -->|"shows when signed out"| node_login
node_app -->|"renders"| node_animal_form
node_app -->|"renders"| node_mother_manager
node_app -->|"renders"| node_animal_detail
node_app -->|"loads dashboard data"| node_http_client
node_animal_form -->|"creates animal"| node_http_client
node_mother_manager -->|"manages mothers"| node_http_client
node_animal_detail -->|"manages weigh-ins"| node_http_client
node_http_client -->|"calls account API"| node_auth_routes
node_http_client -->|"calls herd API"| node_herd_routes
node_http_client -->|"calls weigh-in API"| node_weigh_routes
node_auth_routes -->|"hashes and signs"| node_auth_security
node_auth_routes -->|"reads and writes accounts"| node_sqlite
node_herd_routes -->|"requires token"| node_auth_security
node_herd_routes -->|"reads and writes herd"| node_sqlite
node_weigh_routes -->|"requires token"| node_auth_security
node_weigh_routes -->|"reads and writes weights"| node_sqlite
node_herd_routes -->|"calculates growth"| node_gmq
node_weigh_routes -->|"uses weight calculations"| node_gmq
node_gmq -->|"reads weights and yield"| node_sqlite

click node_app "https://github.com/baptchau/gmq/blob/master/frontend/src/App.vue"
click node_login "https://github.com/baptchau/gmq/blob/master/frontend/src/components/Login.vue"
click node_animal_form "https://github.com/baptchau/gmq/blob/master/frontend/src/components/BroutardForm.vue"
click node_mother_manager "https://github.com/baptchau/gmq/blob/master/frontend/src/components/MereManager.vue"
click node_animal_detail "https://github.com/baptchau/gmq/blob/master/frontend/src/components/BroutardDetail.vue"
click node_http_client "https://github.com/baptchau/gmq/blob/master/frontend/src/api.js"
click node_auth_routes "https://github.com/baptchau/gmq/blob/master/backend/src/server.js"
click node_herd_routes "https://github.com/baptchau/gmq/blob/master/backend/src/server.js"
click node_weigh_routes "https://github.com/baptchau/gmq/blob/master/backend/src/server.js"
click node_auth_security "https://github.com/baptchau/gmq/blob/master/backend/src/auth.js"
click node_gmq "https://github.com/baptchau/gmq/blob/master/backend/src/db.js"
click node_sqlite "https://github.com/baptchau/gmq/blob/master/backend/src/db.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_app,node_login,node_animal_form,node_mother_manager,node_animal_detail,node_http_client toneBlue
class node_auth_routes,node_herd_routes,node_weigh_routes,node_auth_security,node_gmq toneAmber
class node_sqlite toneMint
class node_operator toneIndigo
```

## Components

### Farm interface

- [Session and dashboard](https://github.com/baptchau/gmq/blob/master/frontend/src/App.vue): `frontend/src/App.vue`
- [Account access](https://github.com/baptchau/gmq/blob/master/frontend/src/components/Login.vue): `frontend/src/components/Login.vue`
- [Animal registration](https://github.com/baptchau/gmq/blob/master/frontend/src/components/BroutardForm.vue): `frontend/src/components/BroutardForm.vue`
- [Mother records](https://github.com/baptchau/gmq/blob/master/frontend/src/components/MereManager.vue): `frontend/src/components/MereManager.vue`
- [Animal and weigh-ins](https://github.com/baptchau/gmq/blob/master/frontend/src/components/BroutardDetail.vue): `frontend/src/components/BroutardDetail.vue`
- [API client](https://github.com/baptchau/gmq/blob/master/frontend/src/api.js): `frontend/src/api.js`

### API and domain

- [Account routes](https://github.com/baptchau/gmq/blob/master/backend/src/server.js): `backend/src/server.js`
- [Herd routes](https://github.com/baptchau/gmq/blob/master/backend/src/server.js): `backend/src/server.js`
- [Weigh-in routes](https://github.com/baptchau/gmq/blob/master/backend/src/server.js): `backend/src/server.js`
- [JWT and passwords](https://github.com/baptchau/gmq/blob/master/backend/src/auth.js): `backend/src/auth.js`
- [Yield and GMQ](https://github.com/baptchau/gmq/blob/master/backend/src/db.js): `backend/src/db.js`

### Data storage

- [SQLite records](https://github.com/baptchau/gmq/blob/master/backend/src/db.js): `backend/src/db.js`

### Other components

- **Farm operator**

## Connections

- Farm operator → Account access: signs in (evidence: `frontend/src/components/Login.vue`)
- Account access → API client: requests account (evidence: `frontend/src/components/Login.vue`)
- Session and dashboard → Account access: shows when signed out (evidence: `frontend/src/App.vue`)
- Session and dashboard → Animal registration: renders (evidence: `frontend/src/App.vue`)
- Session and dashboard → Mother records: renders (evidence: `frontend/src/App.vue`)
- Session and dashboard → Animal and weigh-ins: renders (evidence: `frontend/src/App.vue`)
- Session and dashboard → API client: loads dashboard data (evidence: `frontend/src/App.vue`)
- Animal registration → API client: creates animal (evidence: `frontend/src/components/BroutardForm.vue`)
- Mother records → API client: manages mothers (evidence: `frontend/src/components/MereManager.vue`)
- Animal and weigh-ins → API client: manages weigh-ins (evidence: `frontend/src/components/BroutardDetail.vue`)
- API client → Account routes: calls account API (evidence: `README.md`)
- API client → Herd routes: calls herd API (evidence: `README.md`)
- API client → Weigh-in routes: calls weigh-in API (evidence: `README.md`)
- Account routes → JWT and passwords: hashes and signs (evidence: `backend/src/server.js`)
- Account routes → SQLite records: reads and writes accounts (evidence: `backend/src/server.js`)
- Herd routes → JWT and passwords: requires token (evidence: `backend/src/server.js`)
- Herd routes → SQLite records: reads and writes herd (evidence: `backend/src/server.js`)
- Weigh-in routes → JWT and passwords: requires token (evidence: `backend/src/server.js`)
- Weigh-in routes → SQLite records: reads and writes weights (evidence: `backend/src/server.js`)
- Herd routes → Yield and GMQ: calculates growth (evidence: `backend/src/server.js`)
- Weigh-in routes → Yield and GMQ: uses weight calculations (evidence: `backend/src/server.js`)
- Yield and GMQ → SQLite records: reads weights and yield (evidence: `backend/src/db.js`)
