# tudeptrai1712/bio-page architecture

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

- Interactive diagram: https://gitdiagram.com/tudeptrai1712/bio-page
- Repository: https://github.com/tudeptrai1712/bio-page

## Overview

Self-Hosted Bio Page serves a customizable public link-in-bio page and an authenticated admin dashboard. Visitors receive server-rendered profile content; the public API also exposes profile/theme data and records views and link clicks. Admins edit profile and links, manage uploads, and configure password, TOTP, and passkey sign-in. SQLite stores application records; Redis accelerates public responses, tracks counters, and stores challenges and revocations. The source index and excerpts show the main route wiring and selected calls; some UI-to-API and unsampled feature details are documented in the README rather than verified in source.

Main entry points: [`src/app.js`](https://github.com/tudeptrai1712/bio-page/blob/main/src/app.js) (HTTP Application), [`src/routes/auth.js`](https://github.com/tudeptrai1712/bio-page/blob/main/src/routes/auth.js) (Password and TOTP API), [`src/routes/webauthn.js`](https://github.com/tudeptrai1712/bio-page/blob/main/src/routes/webauthn.js) (Passkey API), [`src/redis.js`](https://github.com/tudeptrai1712/bio-page/blob/main/src/redis.js) (Redis and Cache)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_web["Web Experience"]
  node_app["HTTP Application<br/>[app.js]"]
  node_public_ui["Public Page UI<br/>[main.js]"]
  node_admin_ui["Admin Dashboard UI<br/>[admin.js]"]
  node_login_ui["Login UI<br/>[login.js]"]
  node_admin_webauthn_ui["Passkey Manager UI<br/>[webauthn-admin.js]"]
end

subgraph group_content["Profile and Analytics"]
  node_public_routes["Public API<br/>[public.js]"]
  node_renderer["Page Renderer<br/>[renderer.js]"]
  node_admin_routes["Admin API<br/>[admin.js]"]
  node_analytics["Analytics Events<br/>[public.js]"]
end

subgraph group_identity["Authentication and Security"]
  node_auth_routes["Password and TOTP API<br/>[auth.js]"]
  node_webauthn_routes["Passkey API<br/>[webauthn.js]"]
  node_auth["Session and Password Logic<br/>[auth.js]"]
  node_totp["TOTP Logic<br/>[totp.js]"]
  node_webauthn["WebAuthn Logic<br/>[webauthn.js]"]
  node_security["Security Middleware<br/>[security.js]"]
  node_rate_limit["Rate Limiter<br/>[rateLimit.js]"]
  node_uploads["Upload Protection<br/>[upload.js]"]
end

subgraph group_platform["Data and Services"]
  node_sqlite[("SQLite Database<br/>[db.js]")]
  node_redis[("Redis and Cache<br/>[redis.js]")]
  node_logger["Audit Logger<br/>[logger.js]"]
end

node_visitor(("Visitor"))
node_admin_user(("Admin"))

node_visitor -->|"requests page"| node_app
node_admin_user -->|"opens dashboard"| node_app
node_app -->|"renders page"| node_renderer
node_app -->|"mounts routes"| node_public_routes
node_app -->|"mounts routes"| node_auth_routes
node_app -->|"mounts routes"| node_webauthn_routes
node_app -->|"mounts routes"| node_admin_routes
node_app -->|"applies headers"| node_security
node_renderer -->|"reads profile"| node_sqlite
node_renderer -->|"reads and caches HTML"| node_redis
node_public_routes -->|"reads public data"| node_sqlite
node_public_routes -->|"caches profile and theme"| node_redis
node_public_routes -->|"routes analytics"| node_analytics
node_analytics -->|"records events"| node_sqlite
node_analytics -->|"increments counters"| node_redis
node_admin_routes -->|"updates content"| node_sqlite
node_admin_routes -->|"invalidates cache"| node_redis
node_admin_routes -->|"validates uploads"| node_uploads
node_auth_routes -->|"checks credentials"| node_sqlite
node_auth_routes -->|"uses session logic"| node_auth
node_auth_routes -->|"verifies codes"| node_totp
node_auth_routes -->|"limits attempts"| node_rate_limit
node_webauthn_routes -->|"loads credentials"| node_sqlite
node_webauthn_routes -->|"creates sessions"| node_auth
node_webauthn_routes -->|"stores challenges"| node_redis
node_webauthn_routes -->|"verifies credentials"| node_webauthn
node_webauthn_routes -->|"limits attempts"| node_rate_limit
node_auth -->|"stores revocations"| node_redis
node_rate_limit -->|"uses distributed limits"| node_redis
node_rate_limit -->|"logs blocked requests"| node_logger
node_auth_routes -->|"audits sign-in"| node_logger
node_admin_routes -->|"audits changes"| node_logger
node_public_ui -.->|"requests page data"| node_app
node_admin_ui -.->|"edits bio settings"| node_app
node_login_ui -.->|"starts sign-in"| node_app
node_admin_webauthn_ui -.->|"manages passkeys"| node_app

click node_app "https://github.com/tudeptrai1712/bio-page/blob/main/src/app.js"
click node_public_ui "https://github.com/tudeptrai1712/bio-page/blob/main/public/js/main.js"
click node_admin_ui "https://github.com/tudeptrai1712/bio-page/blob/main/src/views/admin/admin.js"
click node_login_ui "https://github.com/tudeptrai1712/bio-page/blob/main/public/js/login.js"
click node_admin_webauthn_ui "https://github.com/tudeptrai1712/bio-page/blob/main/src/views/admin/webauthn-admin.js"
click node_public_routes "https://github.com/tudeptrai1712/bio-page/blob/main/src/routes/public.js"
click node_renderer "https://github.com/tudeptrai1712/bio-page/blob/main/src/renderer.js"
click node_admin_routes "https://github.com/tudeptrai1712/bio-page/blob/main/src/routes/admin.js"
click node_analytics "https://github.com/tudeptrai1712/bio-page/blob/main/src/routes/public.js"
click node_sqlite "https://github.com/tudeptrai1712/bio-page/blob/main/src/db.js"
click node_redis "https://github.com/tudeptrai1712/bio-page/blob/main/src/redis.js"
click node_auth_routes "https://github.com/tudeptrai1712/bio-page/blob/main/src/routes/auth.js"
click node_webauthn_routes "https://github.com/tudeptrai1712/bio-page/blob/main/src/routes/webauthn.js"
click node_auth "https://github.com/tudeptrai1712/bio-page/blob/main/src/auth.js"
click node_totp "https://github.com/tudeptrai1712/bio-page/blob/main/src/totp.js"
click node_webauthn "https://github.com/tudeptrai1712/bio-page/blob/main/src/webauthn.js"
click node_security "https://github.com/tudeptrai1712/bio-page/blob/main/src/middleware/security.js"
click node_rate_limit "https://github.com/tudeptrai1712/bio-page/blob/main/src/middleware/rateLimit.js"
click node_uploads "https://github.com/tudeptrai1712/bio-page/blob/main/src/middleware/upload.js"
click node_logger "https://github.com/tudeptrai1712/bio-page/blob/main/src/logger.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_public_ui,node_admin_ui,node_login_ui,node_admin_webauthn_ui toneBlue
class node_public_routes,node_renderer,node_admin_routes,node_analytics toneAmber
class node_auth_routes,node_webauthn_routes,node_auth,node_totp,node_webauthn,node_security,node_rate_limit,node_uploads toneMint
class node_sqlite,node_redis,node_logger toneRose
class node_visitor,node_admin_user toneIndigo
```

## Components

### Web Experience

- [HTTP Application](https://github.com/tudeptrai1712/bio-page/blob/main/src/app.js): `src/app.js`
- [Public Page UI](https://github.com/tudeptrai1712/bio-page/blob/main/public/js/main.js): `public/js/main.js`
- [Admin Dashboard UI](https://github.com/tudeptrai1712/bio-page/blob/main/src/views/admin/admin.js): `src/views/admin/admin.js`
- [Login UI](https://github.com/tudeptrai1712/bio-page/blob/main/public/js/login.js): `public/js/login.js`
- [Passkey Manager UI](https://github.com/tudeptrai1712/bio-page/blob/main/src/views/admin/webauthn-admin.js): `src/views/admin/webauthn-admin.js`

### Profile and Analytics

- [Public API](https://github.com/tudeptrai1712/bio-page/blob/main/src/routes/public.js): `src/routes/public.js`
- [Page Renderer](https://github.com/tudeptrai1712/bio-page/blob/main/src/renderer.js): `src/renderer.js`
- [Admin API](https://github.com/tudeptrai1712/bio-page/blob/main/src/routes/admin.js): `src/routes/admin.js`
- [Analytics Events](https://github.com/tudeptrai1712/bio-page/blob/main/src/routes/public.js): `src/routes/public.js`

### Authentication and Security

- [Password and TOTP API](https://github.com/tudeptrai1712/bio-page/blob/main/src/routes/auth.js): `src/routes/auth.js`
- [Passkey API](https://github.com/tudeptrai1712/bio-page/blob/main/src/routes/webauthn.js): `src/routes/webauthn.js`
- [Session and Password Logic](https://github.com/tudeptrai1712/bio-page/blob/main/src/auth.js): `src/auth.js`
- [TOTP Logic](https://github.com/tudeptrai1712/bio-page/blob/main/src/totp.js): `src/totp.js`
- [WebAuthn Logic](https://github.com/tudeptrai1712/bio-page/blob/main/src/webauthn.js): `src/webauthn.js`
- [Security Middleware](https://github.com/tudeptrai1712/bio-page/blob/main/src/middleware/security.js): `src/middleware/security.js`
- [Rate Limiter](https://github.com/tudeptrai1712/bio-page/blob/main/src/middleware/rateLimit.js): `src/middleware/rateLimit.js`
- [Upload Protection](https://github.com/tudeptrai1712/bio-page/blob/main/src/middleware/upload.js): `src/middleware/upload.js`

### Data and Services

- [SQLite Database](https://github.com/tudeptrai1712/bio-page/blob/main/src/db.js): `src/db.js`
- [Redis and Cache](https://github.com/tudeptrai1712/bio-page/blob/main/src/redis.js): `src/redis.js`
- [Audit Logger](https://github.com/tudeptrai1712/bio-page/blob/main/src/logger.js): `src/logger.js`

### Other components

- **Visitor**
- **Admin**

## Connections

- Visitor → HTTP Application: requests page (evidence: `src/app.js`)
- Admin → HTTP Application: opens dashboard (evidence: `src/app.js`)
- HTTP Application → Page Renderer: renders page (evidence: `src/app.js`)
- HTTP Application → Public API: mounts routes (evidence: `src/app.js`)
- HTTP Application → Password and TOTP API: mounts routes (evidence: `src/app.js`)
- HTTP Application → Passkey API: mounts routes (evidence: `src/app.js`)
- HTTP Application → Admin API: mounts routes (evidence: `src/app.js`)
- HTTP Application → Security Middleware: applies headers (evidence: `src/app.js`)
- Page Renderer → SQLite Database: reads profile (evidence: `src/renderer.js`)
- Page Renderer → Redis and Cache: reads and caches HTML (evidence: `src/renderer.js`)
- Public API → SQLite Database: reads public data (evidence: `src/routes/public.js`)
- Public API → Redis and Cache: caches profile and theme (evidence: `src/routes/public.js`)
- Public API → Analytics Events: routes analytics (evidence: `src/app.js`)
- Analytics Events → SQLite Database: records events (evidence: `src/routes/public.js`)
- Analytics Events → Redis and Cache: increments counters (evidence: `src/routes/public.js`)
- Admin API → SQLite Database: updates content (evidence: `src/routes/admin.js`)
- Admin API → Redis and Cache: invalidates cache (evidence: `src/routes/admin.js`)
- Admin API → Upload Protection: validates uploads (evidence: `src/routes/admin.js`)
- Password and TOTP API → SQLite Database: checks credentials (evidence: `src/routes/auth.js`)
- Password and TOTP API → Session and Password Logic: uses session logic (evidence: `src/routes/auth.js`)
- Password and TOTP API → TOTP Logic: verifies codes (evidence: `src/routes/auth.js`)
- Password and TOTP API → Rate Limiter: limits attempts (evidence: `src/routes/auth.js`)
- Passkey API → SQLite Database: loads credentials (evidence: `src/routes/webauthn.js`)
- Passkey API → Session and Password Logic: creates sessions (evidence: `src/routes/webauthn.js`)
- Passkey API → Redis and Cache: stores challenges (evidence: `src/routes/webauthn.js`)
- Passkey API → WebAuthn Logic: verifies credentials (evidence: `src/routes/webauthn.js`)
- Passkey API → Rate Limiter: limits attempts (evidence: `src/routes/webauthn.js`)
- Session and Password Logic → Redis and Cache: stores revocations (evidence: `src/auth.js`)
- Rate Limiter → Redis and Cache: uses distributed limits (evidence: `src/middleware/rateLimit.js`)
- Rate Limiter → Audit Logger: logs blocked requests (evidence: `src/middleware/rateLimit.js`)
- Password and TOTP API → Audit Logger: audits sign-in (evidence: `src/routes/auth.js`)
- Admin API → Audit Logger: audits changes (evidence: `src/routes/admin.js`)
- Public Page UI → HTTP Application: requests page data (evidence: `README.md`)
- Admin Dashboard UI → HTTP Application: edits bio settings (evidence: `README.md`)
- Login UI → HTTP Application: starts sign-in (evidence: `README.md`)
- Passkey Manager UI → HTTP Application: manages passkeys (evidence: `README.md`)
