# dwyl/learn-postgresql architecture

> Architecture diagram of the GitHub repository dwyl/learn-postgresql, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-09-30). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/dwyl/learn-postgresql
- Repository: https://github.com/dwyl/learn-postgresql

## Overview

This repository is both a PostgreSQL learning tutorial and a small GitHub-data collection example. The documented learning path introduces PostgreSQL, getting started, SQL queries, writing queries, and deployment; the sampled runtime separately serves a client page and includes a scraper that stores GitHub data. Runtime links are limited to relationships visible in the excerpts or source index. The schema, query examples, and guide files are present in the tree, but their contents were not sampled.

Main entry points: [`README.md`](https://github.com/dwyl/learn-postgresql/blob/main/README.md) (Postgres tutorial), [`server/bot.js`](https://github.com/dwyl/learn-postgresql/blob/main/server/bot.js) (GitHub scraper), [`server/server.js`](https://github.com/dwyl/learn-postgresql/blob/main/server/server.js) (HTTP server), [`server/db.js`](https://github.com/dwyl/learn-postgresql/blob/main/server/db.js) (Database access)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_learning["Learning materials"]
  node_tutorial["Postgres tutorial<br/>[README.md]"]
  node_setup["Getting started<br/>[install.md]"]
  node_sqlguide["SQL guides<br/>[tutorial.md]"]
  node_commands["SQL commands<br/>[commands.md]"]
  node_faq["FAQ<br/>[FAQ.md]"]
  node_queryexamples["Query examples<br/>[query.sql]"]
end

subgraph group_example["Example application"]
  node_http["HTTP server<br/>[server.js]"]
  node_handlers["Page handler"]
  node_clientpage["Client page<br/>[index.html]"]
  node_lanip["LAN address<br/>[lanip.js]"]
end

subgraph group_collection["GitHub data collection"]
  node_scraper["GitHub scraper<br/>[bot.js]"]
  node_utils["Runtime utilities<br/>[utils.js]"]
end

subgraph group_storage["Persistence"]
  node_schema["Database schema<br/>[schema.sql]"]
  node_dbaccess["Database access<br/>[db.js]"]
  node_postgres[("PostgreSQL")]
end

node_learner(("Learner"))
node_browser(("Browser user"))
node_github["GitHub service"]

node_learner -->|"learns from"| node_tutorial
node_tutorial -->|"covers setup"| node_setup
node_tutorial -->|"covers SQL"| node_sqlguide
node_tutorial -->|"shows examples"| node_queryexamples
node_tutorial -.->|"query guidance"| node_commands
node_tutorial -.->|"answers questions"| node_faq
node_tutorial -.->|"explains storage"| node_schema
node_tutorial -->|"covers deployment"| node_setup
node_browser -.->|"requests page"| node_http
node_http -->|"routes requests"| node_handlers
node_handlers -->|"reads and serves"| node_clientpage
node_http -->|"gets LAN address"| node_lanip
node_scraper -->|"fetches data"| node_github
node_scraper -->|"stores records"| node_dbaccess
node_scraper -->|"logs errors"| node_utils
node_dbaccess -->|"uses callbacks and logging"| node_utils
node_dbaccess -->|"queries"| node_postgres
node_schema -.->|"defines tables"| node_postgres

click node_tutorial "https://github.com/dwyl/learn-postgresql/blob/main/README.md"
click node_setup "https://github.com/dwyl/learn-postgresql/blob/main/install.md"
click node_sqlguide "https://github.com/dwyl/learn-postgresql/blob/main/tutorial.md"
click node_commands "https://github.com/dwyl/learn-postgresql/blob/main/commands.md"
click node_faq "https://github.com/dwyl/learn-postgresql/blob/main/FAQ.md"
click node_queryexamples "https://github.com/dwyl/learn-postgresql/blob/main/query.sql"
click node_schema "https://github.com/dwyl/learn-postgresql/blob/main/schema.sql"
click node_http "https://github.com/dwyl/learn-postgresql/blob/main/server/server.js"
click node_handlers "https://github.com/dwyl/learn-postgresql/blob/main/server/request_handlers.js"
click node_clientpage "https://github.com/dwyl/learn-postgresql/blob/main/client/index.html"
click node_lanip "https://github.com/dwyl/learn-postgresql/blob/main/server/lanip.js"
click node_scraper "https://github.com/dwyl/learn-postgresql/blob/main/server/bot.js"
click node_dbaccess "https://github.com/dwyl/learn-postgresql/blob/main/server/db.js"
click node_utils "https://github.com/dwyl/learn-postgresql/blob/main/server/utils.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_tutorial,node_setup,node_sqlguide,node_commands,node_faq,node_queryexamples,node_browser toneBlue
class node_http,node_handlers,node_clientpage,node_lanip toneAmber
class node_scraper,node_utils toneMint
class node_schema,node_dbaccess,node_postgres toneRose
class node_learner,node_github toneIndigo
```

## Components

### Learning materials

- [Postgres tutorial](https://github.com/dwyl/learn-postgresql/blob/main/README.md): `README.md`
- [Getting started](https://github.com/dwyl/learn-postgresql/blob/main/install.md): `install.md`
- [SQL guides](https://github.com/dwyl/learn-postgresql/blob/main/tutorial.md): `tutorial.md`
- [SQL commands](https://github.com/dwyl/learn-postgresql/blob/main/commands.md): `commands.md`
- [FAQ](https://github.com/dwyl/learn-postgresql/blob/main/FAQ.md): `FAQ.md`
- [Query examples](https://github.com/dwyl/learn-postgresql/blob/main/query.sql): `query.sql`

### Example application

- [HTTP server](https://github.com/dwyl/learn-postgresql/blob/main/server/server.js): `server/server.js`
- [Page handler](https://github.com/dwyl/learn-postgresql/blob/main/server/request_handlers.js): `server/request_handlers.js`
- [Client page](https://github.com/dwyl/learn-postgresql/blob/main/client/index.html): `client/index.html`
- [LAN address](https://github.com/dwyl/learn-postgresql/blob/main/server/lanip.js): `server/lanip.js`

### GitHub data collection

- [GitHub scraper](https://github.com/dwyl/learn-postgresql/blob/main/server/bot.js): `server/bot.js`
- [Runtime utilities](https://github.com/dwyl/learn-postgresql/blob/main/server/utils.js): `server/utils.js`

### Persistence

- [Database schema](https://github.com/dwyl/learn-postgresql/blob/main/schema.sql): `schema.sql`
- [Database access](https://github.com/dwyl/learn-postgresql/blob/main/server/db.js): `server/db.js`
- **PostgreSQL**

### Other components

- **Learner**
- **Browser user**
- **GitHub service**

## Connections

- Learner → Postgres tutorial: learns from (evidence: `README.md`)
- Postgres tutorial → Getting started: covers setup (evidence: `README.md`)
- Postgres tutorial → SQL guides: covers SQL (evidence: `README.md`)
- Postgres tutorial → Query examples: shows examples (evidence: `README.md`)
- Postgres tutorial → SQL commands: query guidance
- Postgres tutorial → FAQ: answers questions
- Postgres tutorial → Database schema: explains storage
- Postgres tutorial → Getting started: covers deployment (evidence: `README.md`)
- Browser user → HTTP server: requests page
- HTTP server → Page handler: routes requests (evidence: `server/server.js`)
- Page handler → Client page: reads and serves (evidence: `server/request_handlers.js`)
- HTTP server → LAN address: gets LAN address (evidence: `server/server.js`)
- GitHub scraper → GitHub service: fetches data (evidence: `server/bot.js`)
- GitHub scraper → Database access: stores records (evidence: `server/bot.js`)
- GitHub scraper → Runtime utilities: logs errors (evidence: `server/bot.js`)
- Database access → Runtime utilities: uses callbacks and logging (evidence: `server/db.js`)
- Database access → PostgreSQL: queries (evidence: `server/db.js`)
- Database schema → PostgreSQL: defines tables
