# cloudtechdevops/2nd10weeksofcloudops-main architecture

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

- Interactive diagram: https://gitdiagram.com/cloudtechdevops/2nd10weeksofcloudops-main
- Repository: https://github.com/cloudtechdevops/2nd10weeksofcloudops-main

## Overview

This is a React/Node.js/MySQL book-library application, accompanied by AWS and Kubernetes deployment configuration. The main workflow is browsing and filtering books, viewing details, and—after authentication—creating, editing, or deleting books. The API persists catalog and account data in MySQL and broadcasts book changes to connected clients. The README documents AWS deployment; infrastructure files are present, but their internal wiring was not sampled, so those relationships are left unspecified.

Main entry points: [`client/src/App.jsx`](https://github.com/cloudtechdevops/2nd10weeksofcloudops-main/blob/main/client/src/App.jsx) (App routing), [`backend/index.js`](https://github.com/cloudtechdevops/2nd10weeksofcloudops-main/blob/main/backend/index.js) (Express server), [`client/src/hooks/useBooks.js`](https://github.com/cloudtechdevops/2nd10weeksofcloudops-main/blob/main/client/src/hooks/useBooks.js) (Book data hooks), [`ROOT-terraform/envs/main.tf`](https://github.com/cloudtechdevops/2nd10weeksofcloudops-main/blob/main/ROOT-terraform/envs/main.tf) (AWS environment)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_presentation["Web application"]
  node_app_routes["App routing<br/>[App.jsx]"]
  node_auth_context["Session state<br/>[AuthContext.jsx]"]
  node_auth_pages["Login and registration<br/>[LoginPage.jsx]"]
  node_layout["Library layout<br/>[Layout.jsx]"]
  node_book_list["Book discovery<br/>[BooksPage.jsx]"]
  node_book_cards["Book cards<br/>[BookCard.jsx]"]
  node_book_detail["Book details<br/>[BookDetailPage.jsx]"]
  node_book_form["Book editor<br/>[BookForm.jsx]"]
  node_book_write_pages["Add and edit pages<br/>[AddBookPage.jsx]"]
  node_loading_ui["Loading indicator<br/>[Spinner.jsx]"]
  node_book_hooks["Book data hooks<br/>[useBooks.js]"]
  node_api_client["HTTP and socket client<br/>[config.js]"]
end

subgraph group_api["Application API"]
  node_api_server["Express server<br/>[index.js]"]
  node_auth_routes["Authentication routes<br/>[auth.js]"]
  node_book_routes["Book routes<br/>[books.js]"]
  node_token_auth["Token middleware<br/>[auth.js]"]
  node_realtime["Live update broadcasts<br/>[index.js]"]
end

subgraph group_data["Persistence"]
  node_db_pool["Database access<br/>[pool.js]"]
  node_mysql[("MySQL database")]
end

subgraph group_cloud["Deployment infrastructure"]
  node_aws["AWS environment<br/>[main.tf]"]
  node_networking["Network resources<br/>[main.tf]"]
  node_eks["Kubernetes cluster<br/>[main.tf]"]
  node_rds["Database resources<br/>[main.tf]"]
  node_k8s_manifests["Kubernetes workloads"]
end

node_reader(("Reader"))

node_reader -->|"uses"| node_app_routes
node_app_routes -->|"checks session"| node_auth_context
node_app_routes -->|"renders"| node_layout
node_app_routes -->|"routes to"| node_book_list
node_app_routes -->|"routes to"| node_book_detail
node_app_routes -->|"guards routes"| node_book_write_pages
node_app_routes -->|"routes to"| node_auth_pages
node_app_routes -->|"shows"| node_loading_ui
node_auth_pages -->|"uses"| node_auth_context
node_auth_context -->|"calls auth API"| node_api_client
node_layout -->|"reads session"| node_auth_context
node_book_list -->|"loads catalog"| node_book_hooks
node_book_list -->|"renders"| node_book_cards
node_book_detail -->|"loads and deletes"| node_book_hooks
node_book_write_pages -->|"renders"| node_book_form
node_book_write_pages -->|"submits changes"| node_book_hooks
node_book_form -->|"loads categories"| node_book_hooks
node_book_hooks -->|"calls book API"| node_api_client
node_book_hooks -->|"subscribes to updates"| node_api_client
node_api_client -->|"sends API requests"| node_api_server
node_api_server -->|"mounts routes"| node_auth_routes
node_api_server -->|"mounts routes"| node_book_routes
node_api_server -->|"checks connection"| node_db_pool
node_api_server -->|"broadcasts mutations"| node_realtime
node_auth_routes -->|"queries accounts"| node_db_pool
node_auth_routes -->|"protects profile route"| node_token_auth
node_book_routes -->|"queries books"| node_db_pool
node_book_routes -->|"checks access"| node_token_auth
node_db_pool -->|"reads and writes"| node_mysql
node_api_server -.->|"deployment documented"| node_aws
node_aws --> node_networking
node_aws --> node_eks
node_aws --> node_rds
node_eks --> node_k8s_manifests

click node_app_routes "https://github.com/cloudtechdevops/2nd10weeksofcloudops-main/blob/main/client/src/App.jsx"
click node_auth_context "https://github.com/cloudtechdevops/2nd10weeksofcloudops-main/blob/main/client/src/context/AuthContext.jsx"
click node_auth_pages "https://github.com/cloudtechdevops/2nd10weeksofcloudops-main/blob/main/client/src/pages/LoginPage.jsx"
click node_layout "https://github.com/cloudtechdevops/2nd10weeksofcloudops-main/blob/main/client/src/components/Layout.jsx"
click node_book_list "https://github.com/cloudtechdevops/2nd10weeksofcloudops-main/blob/main/client/src/pages/BooksPage.jsx"
click node_book_cards "https://github.com/cloudtechdevops/2nd10weeksofcloudops-main/blob/main/client/src/components/BookCard.jsx"
click node_book_detail "https://github.com/cloudtechdevops/2nd10weeksofcloudops-main/blob/main/client/src/pages/BookDetailPage.jsx"
click node_book_form "https://github.com/cloudtechdevops/2nd10weeksofcloudops-main/blob/main/client/src/components/BookForm.jsx"
click node_book_write_pages "https://github.com/cloudtechdevops/2nd10weeksofcloudops-main/blob/main/client/src/pages/AddBookPage.jsx"
click node_loading_ui "https://github.com/cloudtechdevops/2nd10weeksofcloudops-main/blob/main/client/src/components/Spinner.jsx"
click node_book_hooks "https://github.com/cloudtechdevops/2nd10weeksofcloudops-main/blob/main/client/src/hooks/useBooks.js"
click node_api_client "https://github.com/cloudtechdevops/2nd10weeksofcloudops-main/blob/main/client/src/pages/config.js"
click node_api_server "https://github.com/cloudtechdevops/2nd10weeksofcloudops-main/blob/main/backend/index.js"
click node_auth_routes "https://github.com/cloudtechdevops/2nd10weeksofcloudops-main/blob/main/backend/src/routes/auth.js"
click node_book_routes "https://github.com/cloudtechdevops/2nd10weeksofcloudops-main/blob/main/backend/src/routes/books.js"
click node_token_auth "https://github.com/cloudtechdevops/2nd10weeksofcloudops-main/blob/main/backend/src/middleware/auth.js"
click node_realtime "https://github.com/cloudtechdevops/2nd10weeksofcloudops-main/blob/main/backend/index.js"
click node_db_pool "https://github.com/cloudtechdevops/2nd10weeksofcloudops-main/blob/main/backend/src/db/pool.js"
click node_aws "https://github.com/cloudtechdevops/2nd10weeksofcloudops-main/blob/main/ROOT-terraform/envs/main.tf"
click node_networking "https://github.com/cloudtechdevops/2nd10weeksofcloudops-main/blob/main/ROOT-terraform/modules/networking/main.tf"
click node_eks "https://github.com/cloudtechdevops/2nd10weeksofcloudops-main/blob/main/ROOT-terraform/modules/eks/main.tf"
click node_rds "https://github.com/cloudtechdevops/2nd10weeksofcloudops-main/blob/main/ROOT-terraform/modules/database/main.tf"
click node_k8s_manifests "https://github.com/cloudtechdevops/2nd10weeksofcloudops-main/blob/main/kubernetes-files/backend-deployment.yaml"

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_routes,node_auth_context,node_auth_pages,node_layout,node_book_list,node_book_cards,node_book_detail,node_book_form,node_book_write_pages,node_loading_ui,node_book_hooks,node_api_client toneBlue
class node_api_server,node_auth_routes,node_book_routes,node_token_auth,node_realtime toneAmber
class node_db_pool,node_mysql toneMint
class node_aws,node_networking,node_eks,node_rds,node_k8s_manifests toneRose
class node_reader toneIndigo
```

## Components

### Web application

- [App routing](https://github.com/cloudtechdevops/2nd10weeksofcloudops-main/blob/main/client/src/App.jsx): `client/src/App.jsx`
- [Session state](https://github.com/cloudtechdevops/2nd10weeksofcloudops-main/blob/main/client/src/context/AuthContext.jsx): `client/src/context/AuthContext.jsx`
- [Login and registration](https://github.com/cloudtechdevops/2nd10weeksofcloudops-main/blob/main/client/src/pages/LoginPage.jsx): `client/src/pages/LoginPage.jsx`
- [Library layout](https://github.com/cloudtechdevops/2nd10weeksofcloudops-main/blob/main/client/src/components/Layout.jsx): `client/src/components/Layout.jsx`
- [Book discovery](https://github.com/cloudtechdevops/2nd10weeksofcloudops-main/blob/main/client/src/pages/BooksPage.jsx): `client/src/pages/BooksPage.jsx`
- [Book cards](https://github.com/cloudtechdevops/2nd10weeksofcloudops-main/blob/main/client/src/components/BookCard.jsx): `client/src/components/BookCard.jsx`
- [Book details](https://github.com/cloudtechdevops/2nd10weeksofcloudops-main/blob/main/client/src/pages/BookDetailPage.jsx): `client/src/pages/BookDetailPage.jsx`
- [Book editor](https://github.com/cloudtechdevops/2nd10weeksofcloudops-main/blob/main/client/src/components/BookForm.jsx): `client/src/components/BookForm.jsx`
- [Add and edit pages](https://github.com/cloudtechdevops/2nd10weeksofcloudops-main/blob/main/client/src/pages/AddBookPage.jsx): `client/src/pages/AddBookPage.jsx`
- [Loading indicator](https://github.com/cloudtechdevops/2nd10weeksofcloudops-main/blob/main/client/src/components/Spinner.jsx): `client/src/components/Spinner.jsx`
- [Book data hooks](https://github.com/cloudtechdevops/2nd10weeksofcloudops-main/blob/main/client/src/hooks/useBooks.js): `client/src/hooks/useBooks.js`
- [HTTP and socket client](https://github.com/cloudtechdevops/2nd10weeksofcloudops-main/blob/main/client/src/pages/config.js): `client/src/pages/config.js`

### Application API

- [Express server](https://github.com/cloudtechdevops/2nd10weeksofcloudops-main/blob/main/backend/index.js): `backend/index.js`
- [Authentication routes](https://github.com/cloudtechdevops/2nd10weeksofcloudops-main/blob/main/backend/src/routes/auth.js): `backend/src/routes/auth.js`
- [Book routes](https://github.com/cloudtechdevops/2nd10weeksofcloudops-main/blob/main/backend/src/routes/books.js): `backend/src/routes/books.js`
- [Token middleware](https://github.com/cloudtechdevops/2nd10weeksofcloudops-main/blob/main/backend/src/middleware/auth.js): `backend/src/middleware/auth.js`
- [Live update broadcasts](https://github.com/cloudtechdevops/2nd10weeksofcloudops-main/blob/main/backend/index.js): `backend/index.js`

### Persistence

- [Database access](https://github.com/cloudtechdevops/2nd10weeksofcloudops-main/blob/main/backend/src/db/pool.js): `backend/src/db/pool.js`
- **MySQL database**

### Deployment infrastructure

- [AWS environment](https://github.com/cloudtechdevops/2nd10weeksofcloudops-main/blob/main/ROOT-terraform/envs/main.tf): `ROOT-terraform/envs/main.tf`
- [Network resources](https://github.com/cloudtechdevops/2nd10weeksofcloudops-main/blob/main/ROOT-terraform/modules/networking/main.tf): `ROOT-terraform/modules/networking/main.tf`
- [Kubernetes cluster](https://github.com/cloudtechdevops/2nd10weeksofcloudops-main/blob/main/ROOT-terraform/modules/eks/main.tf): `ROOT-terraform/modules/eks/main.tf`
- [Database resources](https://github.com/cloudtechdevops/2nd10weeksofcloudops-main/blob/main/ROOT-terraform/modules/database/main.tf): `ROOT-terraform/modules/database/main.tf`
- [Kubernetes workloads](https://github.com/cloudtechdevops/2nd10weeksofcloudops-main/blob/main/kubernetes-files/backend-deployment.yaml): `kubernetes-files/backend-deployment.yaml`

### Other components

- **Reader**

## Connections

- Reader → App routing: uses (evidence: `client/src/App.jsx`)
- App routing → Session state: checks session (evidence: `client/src/App.jsx`)
- App routing → Library layout: renders (evidence: `client/src/App.jsx`)
- App routing → Book discovery: routes to (evidence: `client/src/App.jsx`)
- App routing → Book details: routes to (evidence: `client/src/App.jsx`)
- App routing → Add and edit pages: guards routes (evidence: `client/src/App.jsx`)
- App routing → Login and registration: routes to (evidence: `client/src/App.jsx`)
- App routing → Loading indicator: shows (evidence: `client/src/App.jsx`)
- Login and registration → Session state: uses (evidence: `client/src/pages/LoginPage.jsx`)
- Session state → HTTP and socket client: calls auth API (evidence: `client/src/context/AuthContext.jsx`)
- Library layout → Session state: reads session (evidence: `client/src/components/Layout.jsx`)
- Book discovery → Book data hooks: loads catalog (evidence: `client/src/pages/BooksPage.jsx`)
- Book discovery → Book cards: renders (evidence: `client/src/pages/BooksPage.jsx`)
- Book details → Book data hooks: loads and deletes (evidence: `client/src/pages/BookDetailPage.jsx`)
- Add and edit pages → Book editor: renders (evidence: `client/src/pages/AddBookPage.jsx`)
- Add and edit pages → Book data hooks: submits changes (evidence: `client/src/pages/AddBookPage.jsx`)
- Book editor → Book data hooks: loads categories (evidence: `client/src/components/BookForm.jsx`)
- Book data hooks → HTTP and socket client: calls book API (evidence: `client/src/hooks/useBooks.js`)
- Book data hooks → HTTP and socket client: subscribes to updates (evidence: `client/src/hooks/useBooks.js`)
- HTTP and socket client → Express server: sends API requests (evidence: `client/src/pages/config.js`)
- Express server → Authentication routes: mounts routes (evidence: `backend/index.js`)
- Express server → Book routes: mounts routes (evidence: `backend/index.js`)
- Express server → Database access: checks connection (evidence: `backend/index.js`)
- Express server → Live update broadcasts: broadcasts mutations (evidence: `backend/index.js`)
- Authentication routes → Database access: queries accounts (evidence: `backend/src/routes/auth.js`)
- Authentication routes → Token middleware: protects profile route (evidence: `backend/src/routes/auth.js`)
- Book routes → Database access: queries books (evidence: `backend/src/routes/books.js`)
- Book routes → Token middleware: checks access (evidence: `backend/src/routes/books.js`)
- Database access → MySQL database: reads and writes (evidence: `backend/src/db/pool.js`)
- Express server → AWS environment: deployment documented (evidence: `README.md`)
- AWS environment → Network resources
- AWS environment → Kubernetes cluster
- AWS environment → Database resources
- Kubernetes cluster → Kubernetes workloads
