# mhmdhammoud702/tasks architecture

> Architecture diagram of the GitHub repository mhmdhammoud702/tasks, 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/mhmdhammoud702/tasks
- Repository: https://github.com/mhmdhammoud702/tasks

## Overview

The repository contains several small browser exercises and a client/server user manager. Task 1 manages users locally; Task 2 explores country data from an external API. Task 5 provides authenticated user CRUD with database persistence and a cached user list. The sampled source establishes those flows, but Task 3 and Task 4 have no sampled behavior, so they are represented only as pages. No README was present to clarify their intended capabilities.

Main entry points: [`Task 5/backend/src/app.js`](https://github.com/mhmdhammoud702/tasks/blob/main/Task%205/backend/src/app.js) (Express app), [`Task 2/index.js`](https://github.com/mhmdhammoud702/tasks/blob/main/Task%202/index.js) (Country search and view), [`Task 5/backend/src/controllers/users.controller.js`](https://github.com/mhmdhammoud702/tasks/blob/main/Task%205/backend/src/controllers/users.controller.js) (User operations), [`Task 5/backend/src/routes/users.route.js`](https://github.com/mhmdhammoud702/tasks/blob/main/Task%205/backend/src/routes/users.route.js) (User endpoints)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_local["Local User Manager"]
  node_localapp["User form and table<br/>[index.js]"]
  node_localstorage[("Browser storage")]
end

subgraph group_countries["Country Explorer"]
  node_countryapp["Country search and view<br/>[index.js]"]
  node_countryapi["Countries API"]
  node_favorites[("Saved favorites")]
end

subgraph group_service["User Management Service"]
  node_frontend["User manager UI<br/>[index.js]"]
  node_server["Express app<br/>[app.js]"]
  node_authroutes["Token endpoint<br/>[auth.route.js]"]
  node_authcontroller["Token issuance<br/>[auth.controller.js]"]
  node_jwt["JWT signing<br/>[jwt.js]"]
  node_protection["Route protection<br/>[auth.middleware.js]"]
  node_userroutes["User endpoints<br/>[users.route.js]"]
  node_usercontroller["User operations"]
  node_usermodel["User model<br/>[Users.js]"]
  node_mongodb[("MongoDB")]
  node_dbconfig["Database connection<br/>[db.js]"]
  node_cacheconfig["Cache client<br/>[memcached.js]"]
  node_memcached[("Memcached")]
end

subgraph group_pages["Other Task Pages"]
  node_task3["Task 3 page<br/>[index.html]"]
  node_task4["Task 4 page<br/>[index.html]"]
end

node_visitor(("Browser user"))

node_visitor -->|"uses"| node_localapp
node_localapp -->|"reads and writes"| node_localstorage
node_visitor -->|"uses"| node_countryapp
node_countryapp -->|"fetches data"| node_countryapi
node_countryapp -->|"reads and writes"| node_favorites
node_visitor -->|"uses"| node_frontend
node_frontend -->|"sends requests"| node_server
node_server -->|"connects"| node_dbconfig
node_dbconfig -->|"connects"| node_mongodb
node_server -->|"dispatches"| node_authroutes
node_authroutes -->|"dispatches"| node_authcontroller
node_authcontroller -->|"issues token"| node_jwt
node_server -->|"guards users route"| node_protection
node_protection -->|"allows request"| node_userroutes
node_server -->|"dispatches"| node_userroutes
node_userroutes -->|"dispatches"| node_usercontroller
node_usercontroller -->|"queries and updates"| node_usermodel
node_usermodel -->|"persists users"| node_mongodb
node_usercontroller -->|"reads and invalidates"| node_cacheconfig
node_cacheconfig -->|"accesses"| node_memcached
node_visitor -->|"opens"| node_task3
node_visitor -->|"opens"| node_task4

click node_localapp "https://github.com/mhmdhammoud702/tasks/blob/main/Task%201/index.js"
click node_countryapp "https://github.com/mhmdhammoud702/tasks/blob/main/Task%202/index.js"
click node_frontend "https://github.com/mhmdhammoud702/tasks/blob/main/Task%205/frontend/index.js"
click node_server "https://github.com/mhmdhammoud702/tasks/blob/main/Task%205/backend/src/app.js"
click node_authroutes "https://github.com/mhmdhammoud702/tasks/blob/main/Task%205/backend/src/routes/auth.route.js"
click node_authcontroller "https://github.com/mhmdhammoud702/tasks/blob/main/Task%205/backend/src/controllers/auth.controller.js"
click node_jwt "https://github.com/mhmdhammoud702/tasks/blob/main/Task%205/backend/src/config/jwt.js"
click node_protection "https://github.com/mhmdhammoud702/tasks/blob/main/Task%205/backend/middleware/auth.middleware.js"
click node_userroutes "https://github.com/mhmdhammoud702/tasks/blob/main/Task%205/backend/src/routes/users.route.js"
click node_usercontroller "https://github.com/mhmdhammoud702/tasks/blob/main/Task%205/backend/src/controllers/users.controller.js"
click node_usermodel "https://github.com/mhmdhammoud702/tasks/blob/main/Task%205/backend/src/models/Users.js"
click node_dbconfig "https://github.com/mhmdhammoud702/tasks/blob/main/Task%205/backend/src/config/db.js"
click node_cacheconfig "https://github.com/mhmdhammoud702/tasks/blob/main/Task%205/backend/src/config/memcached.js"
click node_task3 "https://github.com/mhmdhammoud702/tasks/blob/main/Task%203/index.html"
click node_task4 "https://github.com/mhmdhammoud702/tasks/blob/main/Task%204/index.html"

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_localapp,node_localstorage,node_visitor toneBlue
class node_countryapp,node_countryapi,node_favorites toneAmber
class node_frontend,node_server,node_authroutes,node_authcontroller,node_jwt,node_protection,node_userroutes,node_usercontroller,node_usermodel,node_mongodb,node_dbconfig,node_cacheconfig,node_memcached toneMint
class node_task3,node_task4 toneRose
```

## Components

### Local User Manager

- [User form and table](https://github.com/mhmdhammoud702/tasks/blob/main/Task%201/index.js): `Task 1/index.js`
- **Browser storage**

### Country Explorer

- [Country search and view](https://github.com/mhmdhammoud702/tasks/blob/main/Task%202/index.js): `Task 2/index.js`
- **Countries API**
- **Saved favorites**

### User Management Service

- [User manager UI](https://github.com/mhmdhammoud702/tasks/blob/main/Task%205/frontend/index.js): `Task 5/frontend/index.js`
- [Express app](https://github.com/mhmdhammoud702/tasks/blob/main/Task%205/backend/src/app.js): `Task 5/backend/src/app.js`
- [Token endpoint](https://github.com/mhmdhammoud702/tasks/blob/main/Task%205/backend/src/routes/auth.route.js): `Task 5/backend/src/routes/auth.route.js`
- [Token issuance](https://github.com/mhmdhammoud702/tasks/blob/main/Task%205/backend/src/controllers/auth.controller.js): `Task 5/backend/src/controllers/auth.controller.js`
- [JWT signing](https://github.com/mhmdhammoud702/tasks/blob/main/Task%205/backend/src/config/jwt.js): `Task 5/backend/src/config/jwt.js`
- [Route protection](https://github.com/mhmdhammoud702/tasks/blob/main/Task%205/backend/middleware/auth.middleware.js): `Task 5/backend/middleware/auth.middleware.js`
- [User endpoints](https://github.com/mhmdhammoud702/tasks/blob/main/Task%205/backend/src/routes/users.route.js): `Task 5/backend/src/routes/users.route.js`
- [User operations](https://github.com/mhmdhammoud702/tasks/blob/main/Task%205/backend/src/controllers/users.controller.js): `Task 5/backend/src/controllers/users.controller.js`
- [User model](https://github.com/mhmdhammoud702/tasks/blob/main/Task%205/backend/src/models/Users.js): `Task 5/backend/src/models/Users.js`
- **MongoDB**
- [Database connection](https://github.com/mhmdhammoud702/tasks/blob/main/Task%205/backend/src/config/db.js): `Task 5/backend/src/config/db.js`
- [Cache client](https://github.com/mhmdhammoud702/tasks/blob/main/Task%205/backend/src/config/memcached.js): `Task 5/backend/src/config/memcached.js`
- **Memcached**

### Other Task Pages

- [Task 3 page](https://github.com/mhmdhammoud702/tasks/blob/main/Task%203/index.html): `Task 3/index.html`
- [Task 4 page](https://github.com/mhmdhammoud702/tasks/blob/main/Task%204/index.html): `Task 4/index.html`

### Other components

- **Browser user**

## Connections

- Browser user → User form and table: uses
- User form and table → Browser storage: reads and writes
- Browser user → Country search and view: uses
- Country search and view → Countries API: fetches data
- Country search and view → Saved favorites: reads and writes
- Browser user → User manager UI: uses
- User manager UI → Express app: sends requests
- Express app → Database connection: connects
- Database connection → MongoDB: connects
- Express app → Token endpoint: dispatches
- Token endpoint → Token issuance: dispatches
- Token issuance → JWT signing: issues token
- Express app → Route protection: guards users route
- Route protection → User endpoints: allows request
- Express app → User endpoints: dispatches
- User endpoints → User operations: dispatches
- User operations → User model: queries and updates
- User model → MongoDB: persists users
- User operations → Cache client: reads and invalidates
- Cache client → Memcached: accesses
- Browser user → Task 3 page: opens
- Browser user → Task 4 page: opens
