# robertmagic52/magic-links architecture

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

- Interactive diagram: https://gitdiagram.com/robertmagic52/magic-links
- Repository: https://github.com/robertmagic52/magic-links

## Overview

magic-links is a small Express portal with spectator and controller page routes plus APIs for reading and editing portal links and a master redirect. The server persists portal data as JSON, initializing defaults and migrating an older link format when needed. The HTML files are served by the routes, but their contents were not sampled, so browser interactions and any redirect behavior are not inferred.

Main entry points: [`index.js`](https://github.com/robertmagic52/magic-links/blob/main/index.js) (Express server), [`index.html`](https://github.com/robertmagic52/magic-links/blob/main/index.html) (Spectator page), [`app.html`](https://github.com/robertmagic52/magic-links/blob/main/app.html) (Controller page)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_server["HTTP server"]
  node_server["Express server<br/>[index.js]"]
  node_api["Portal APIs<br/>[index.js]"]
end

subgraph group_portal["Portal pages"]
  node_pages["Page routes<br/>[index.js]"]
  node_spectator["Spectator page<br/>[index.html]"]
  node_controller["Controller page<br/>[app.html]"]
end

subgraph group_data["Portal data"]
  node_dataops["Data access<br/>[index.js]"]
  node_portaldata[("Portal JSON data<br/>[index.js]")]
end

node_visitor(("Portal visitor"))

node_visitor -->|"requests pages or APIs"| node_server
node_server -->|"routes requests"| node_pages
node_pages -->|"serves at /"| node_spectator
node_pages -->|"serves at /app"| node_controller
node_server -->|"routes API requests"| node_api
node_api -->|"reads or saves"| node_dataops
node_dataops -->|"reads and writes"| node_portaldata

click node_server "https://github.com/robertmagic52/magic-links/blob/main/index.js"
click node_pages "https://github.com/robertmagic52/magic-links/blob/main/index.js"
click node_spectator "https://github.com/robertmagic52/magic-links/blob/main/index.html"
click node_controller "https://github.com/robertmagic52/magic-links/blob/main/app.html"
click node_api "https://github.com/robertmagic52/magic-links/blob/main/index.js"
click node_dataops "https://github.com/robertmagic52/magic-links/blob/main/index.js"
click node_portaldata "https://github.com/robertmagic52/magic-links/blob/main/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_server,node_api toneBlue
class node_pages,node_spectator,node_controller toneAmber
class node_dataops,node_portaldata toneMint
class node_visitor toneIndigo
```

## Components

### HTTP server

- [Express server](https://github.com/robertmagic52/magic-links/blob/main/index.js): `index.js`
- [Portal APIs](https://github.com/robertmagic52/magic-links/blob/main/index.js): `index.js`

### Portal pages

- [Page routes](https://github.com/robertmagic52/magic-links/blob/main/index.js): `index.js`
- [Spectator page](https://github.com/robertmagic52/magic-links/blob/main/index.html): `index.html`
- [Controller page](https://github.com/robertmagic52/magic-links/blob/main/app.html): `app.html`

### Portal data

- [Data access](https://github.com/robertmagic52/magic-links/blob/main/index.js): `index.js`
- [Portal JSON data](https://github.com/robertmagic52/magic-links/blob/main/index.js): `index.js`

### Other components

- **Portal visitor**

## Connections

- Portal visitor → Express server: requests pages or APIs (evidence: `index.js`)
- Express server → Page routes: routes requests (evidence: `index.js`)
- Page routes → Spectator page: serves at / (evidence: `index.js`)
- Page routes → Controller page: serves at /app (evidence: `index.js`)
- Express server → Portal APIs: routes API requests (evidence: `index.js`)
- Portal APIs → Data access: reads or saves (evidence: `index.js`)
- Data access → Portal JSON data: reads and writes (evidence: `index.js`)
