# sammykym/projectd architecture

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

- Interactive diagram: https://gitdiagram.com/sammykym/projectd
- Repository: https://github.com/sammykym/projectd

## Overview

This is a small Express bulletin-board app: visitors can view a rendered message list, retrieve messages through JSON endpoints, and submit a message. The route handlers in `app.js` query MySQL; the home route passes query results to an EJS template. The README contains only a video link, so the architecture is based on the sampled source; update and delete routes are shown as attempted operations, not confirmed working behavior.

Main entry points: [`app.js`](https://github.com/sammykym/projectd/blob/main/app.js) (Express server and middleware), [`view/index.ejs`](https://github.com/sammykym/projectd/blob/main/view/index.ejs) (Message list template), [`public`](https://github.com/sammykym/projectd/tree/main/public) (Static public files)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_web["Web runtime"]
  node_server["Express server and middleware<br/>[app.js]"]
  node_static_files["Static public files"]
end

subgraph group_routes["Board routes"]
  node_home["Home page route<br/>[app.js]"]
  node_list_api["List messages API<br/>[app.js]"]
  node_single_api["Single message API<br/>[app.js]"]
  node_create_api["Create message route<br/>[app.js]"]
  node_update_api["Update route<br/>[app.js]"]
  node_delete_api["Delete route<br/>[app.js]"]
end

subgraph group_data_view["Data and views"]
  node_mysql[("MySQL database")]
  node_message_table[("Message board table")]
  node_index_view["Message list template<br/>[index.ejs]"]
end

node_visitor(("Visitor"))

node_visitor -->|"HTTP requests"| node_server
node_server -->|"routes requests"| node_home
node_server -->|"routes requests"| node_list_api
node_server -->|"routes requests"| node_single_api
node_server -->|"routes requests"| node_create_api
node_server -->|"routes requests"| node_update_api
node_server -->|"routes requests"| node_delete_api
node_home -->|"queries"| node_mysql
node_list_api -->|"queries"| node_mysql
node_single_api -->|"queries"| node_mysql
node_create_api -->|"inserts"| node_mysql
node_update_api -->|"updates"| node_mysql
node_delete_api -->|"deletes"| node_mysql
node_mysql -->|"reads and writes"| node_message_table
node_home -->|"renders with results"| node_index_view
node_index_view -->|"HTML response"| node_visitor
node_list_api -->|"JSON response"| node_visitor
node_single_api -->|"JSON response"| node_visitor
node_create_api -->|"redirects home"| node_visitor
node_update_api -->|"text response"| node_visitor
node_delete_api -->|"text response"| node_visitor
node_server -->|"serves files"| node_static_files

click node_server "https://github.com/sammykym/projectd/blob/main/app.js"
click node_home "https://github.com/sammykym/projectd/blob/main/app.js"
click node_list_api "https://github.com/sammykym/projectd/blob/main/app.js"
click node_single_api "https://github.com/sammykym/projectd/blob/main/app.js"
click node_create_api "https://github.com/sammykym/projectd/blob/main/app.js"
click node_update_api "https://github.com/sammykym/projectd/blob/main/app.js"
click node_delete_api "https://github.com/sammykym/projectd/blob/main/app.js"
click node_index_view "https://github.com/sammykym/projectd/blob/main/view/index.ejs"
click node_static_files "https://github.com/sammykym/projectd/tree/main/public"

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_static_files toneBlue
class node_home,node_list_api,node_single_api,node_create_api,node_update_api,node_delete_api toneAmber
class node_mysql,node_message_table,node_index_view toneMint
class node_visitor toneIndigo
```

## Components

### Web runtime

- [Express server and middleware](https://github.com/sammykym/projectd/blob/main/app.js): `app.js`
- [Static public files](https://github.com/sammykym/projectd/tree/main/public): `public`

### Board routes

- [Home page route](https://github.com/sammykym/projectd/blob/main/app.js): `app.js`
- [List messages API](https://github.com/sammykym/projectd/blob/main/app.js): `app.js`
- [Single message API](https://github.com/sammykym/projectd/blob/main/app.js): `app.js`
- [Create message route](https://github.com/sammykym/projectd/blob/main/app.js): `app.js`
- [Update route](https://github.com/sammykym/projectd/blob/main/app.js): `app.js`
- [Delete route](https://github.com/sammykym/projectd/blob/main/app.js): `app.js`

### Data and views

- **MySQL database**
- **Message board table**
- [Message list template](https://github.com/sammykym/projectd/blob/main/view/index.ejs): `view/index.ejs`

### Other components

- **Visitor**

## Connections

- Visitor → Express server and middleware: HTTP requests
- Express server and middleware → Home page route: routes requests
- Express server and middleware → List messages API: routes requests
- Express server and middleware → Single message API: routes requests
- Express server and middleware → Create message route: routes requests
- Express server and middleware → Update route: routes requests
- Express server and middleware → Delete route: routes requests
- Home page route → MySQL database: queries
- List messages API → MySQL database: queries
- Single message API → MySQL database: queries
- Create message route → MySQL database: inserts
- Update route → MySQL database: updates
- Delete route → MySQL database: deletes
- MySQL database → Message board table: reads and writes
- Home page route → Message list template: renders with results
- Message list template → Visitor: HTML response
- List messages API → Visitor: JSON response
- Single message API → Visitor: JSON response
- Create message route → Visitor: redirects home
- Update route → Visitor: text response
- Delete route → Visitor: text response
- Express server and middleware → Static public files: serves files
