# mgoldie05/bluetag-2 architecture

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

- Interactive diagram: https://gitdiagram.com/mgoldie05/bluetag-2
- Repository: https://github.com/mgoldie05/bluetag-2

## Overview

BlueTag is a small Express lost-and-found board. Students register or sign in, browse and filter listings, post lost/found items, view a listing and contact its poster, and resolve their own posts. The request entry point wires sessions, authentication context, and route handlers; those handlers query or mutate SQLite and render EJS pages. The README documents the user-facing capabilities; relationships for those routes are supported by the sampled route source, while view rendering details are not expanded into separate components.

Main entry points: [`src/index.js`](https://github.com/mgoldie05/bluetag-2/blob/main/src/index.js) (Express server), [`src/db.js`](https://github.com/mgoldie05/bluetag-2/blob/main/src/db.js) (SQLite database), [`src/routes/items.js`](https://github.com/mgoldie05/bluetag-2/blob/main/src/routes/items.js) (Board routes), [`src/routes/auth.js`](https://github.com/mgoldie05/bluetag-2/blob/main/src/routes/auth.js) (Account routes)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_http["HTTP application"]
  node_server["Express server<br/>[index.js]"]
end

subgraph group_identity["Accounts and access"]
  node_auth_context["Auth context<br/>[auth.js]"]
  node_auth_routes["Account routes<br/>[auth.js]"]
end

subgraph group_board["Lost and found board"]
  node_item_routes["Board routes<br/>[items.js]"]
  node_catalog["Search and filters<br/>[items.js]"]
  node_listing["Listing lifecycle<br/>[items.js]"]
end

subgraph group_persistence["Persistence"]
  node_sqlite[("SQLite database<br/>[db.js]")]
  node_demo_data["Demo data seed<br/>[seed.js]"]
end

node_student(("Student"))

node_student -->|"sends requests"| node_server
node_server -->|"attaches user"| node_auth_context
node_server -->|"mounts routes"| node_auth_routes
node_server -->|"mounts routes"| node_item_routes
node_server -->|"runs seed"| node_demo_data
node_server -->|"checks health"| node_sqlite
node_auth_routes -->|"reads and writes accounts"| node_sqlite
node_item_routes -->|"enforces access"| node_auth_context
node_item_routes -->|"handles board requests"| node_catalog
node_item_routes -->|"handles listing requests"| node_listing
node_catalog -->|"queries listings"| node_sqlite
node_listing -->|"creates and updates"| node_sqlite
node_listing -->|"loads item details"| node_sqlite
node_demo_data -->|"seeds records"| node_sqlite

click node_server "https://github.com/mgoldie05/bluetag-2/blob/main/src/index.js"
click node_auth_context "https://github.com/mgoldie05/bluetag-2/blob/main/src/middleware/auth.js"
click node_auth_routes "https://github.com/mgoldie05/bluetag-2/blob/main/src/routes/auth.js"
click node_item_routes "https://github.com/mgoldie05/bluetag-2/blob/main/src/routes/items.js"
click node_catalog "https://github.com/mgoldie05/bluetag-2/blob/main/src/routes/items.js"
click node_listing "https://github.com/mgoldie05/bluetag-2/blob/main/src/routes/items.js"
click node_sqlite "https://github.com/mgoldie05/bluetag-2/blob/main/src/db.js"
click node_demo_data "https://github.com/mgoldie05/bluetag-2/blob/main/src/seed.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_server toneBlue
class node_auth_context,node_auth_routes toneAmber
class node_item_routes,node_catalog,node_listing toneMint
class node_sqlite,node_demo_data toneRose
class node_student toneIndigo
```

## Components

### HTTP application

- [Express server](https://github.com/mgoldie05/bluetag-2/blob/main/src/index.js): `src/index.js`

### Accounts and access

- [Auth context](https://github.com/mgoldie05/bluetag-2/blob/main/src/middleware/auth.js): `src/middleware/auth.js`
- [Account routes](https://github.com/mgoldie05/bluetag-2/blob/main/src/routes/auth.js): `src/routes/auth.js`

### Lost and found board

- [Board routes](https://github.com/mgoldie05/bluetag-2/blob/main/src/routes/items.js): `src/routes/items.js`
- [Search and filters](https://github.com/mgoldie05/bluetag-2/blob/main/src/routes/items.js): `src/routes/items.js`
- [Listing lifecycle](https://github.com/mgoldie05/bluetag-2/blob/main/src/routes/items.js): `src/routes/items.js`

### Persistence

- [SQLite database](https://github.com/mgoldie05/bluetag-2/blob/main/src/db.js): `src/db.js`
- [Demo data seed](https://github.com/mgoldie05/bluetag-2/blob/main/src/seed.js): `src/seed.js`

### Other components

- **Student**

## Connections

- Student → Express server: sends requests (evidence: `README.md`)
- Express server → Auth context: attaches user (evidence: `src/index.js`)
- Express server → Account routes: mounts routes (evidence: `src/index.js`)
- Express server → Board routes: mounts routes (evidence: `src/index.js`)
- Express server → Demo data seed: runs seed (evidence: `src/index.js`)
- Express server → SQLite database: checks health (evidence: `src/index.js`)
- Account routes → SQLite database: reads and writes accounts (evidence: `src/routes/auth.js`)
- Board routes → Auth context: enforces access (evidence: `src/routes/items.js`)
- Board routes → Search and filters: handles board requests (evidence: `src/routes/items.js`)
- Board routes → Listing lifecycle: handles listing requests (evidence: `src/routes/items.js`)
- Search and filters → SQLite database: queries listings (evidence: `src/routes/items.js`)
- Listing lifecycle → SQLite database: creates and updates (evidence: `src/routes/items.js`)
- Listing lifecycle → SQLite database: loads item details (evidence: `src/routes/items.js`)
- Demo data seed → SQLite database: seeds records (evidence: `src/seed.js`)
