# hlozaid/githubclone architecture

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

- Interactive diagram: https://gitdiagram.com/hlozaid/githubclone
- Repository: https://github.com/hlozaid/githubclone

## Overview

GitHub Clone combines a web platform for accounts, profiles, repository discovery and management, stars, and issues with a separate Git-inspired local CLI that stages, commits, transfers, and reverts files. Web requests enter through the Express router and are handled by domain controllers; MongoDB stores platform data, while CLI push/pull use S3. Issue updates can also emit Socket.IO events. Some frontend and controller excerpts are partial, so links for documented but unsampled capabilities rely on the README rather than assumed implementation details.

Main entry points: [`frontend/src/Routes.jsx`](https://github.com/hlozaid/githubclone/blob/main/frontend/src/Routes.jsx) (Page routing), [`backend/index.js`](https://github.com/hlozaid/githubclone/blob/main/backend/index.js) (CLI command dispatch), [`backend/routes/main.router.js`](https://github.com/hlozaid/githubclone/blob/main/backend/routes/main.router.js) (Express route assembly), [`backend/controllers/repoController.js`](https://github.com/hlozaid/githubclone/blob/main/backend/controllers/repoController.js) (Repository management)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_web["Web experience"]
  node_routes_ui["Page routing<br/>[Routes.jsx]"]
  node_auth_ui["Sign in and signup<br/>[Login.jsx]"]
  node_dashboard["Repository discovery<br/>[Dashboard.jsx]"]
  node_repo_create_ui["Create repository"]
  node_repo_detail_ui["Repository and issues"]
  node_profile_ui["Developer profile<br/>[Profile.jsx]"]
  node_auth_context["Session context<br/>[authContext.jsx]"]
  node_api_config["API endpoint config<br/>[config.js]"]
end

subgraph group_api["API and domain"]
  node_api_routes["Express route assembly<br/>[main.router.js]"]
  node_user_routes["User endpoints<br/>[user.router.js]"]
  node_repo_routes["Repository endpoints<br/>[repo.router.js]"]
  node_issue_routes["Issue endpoints<br/>[issue.router.js]"]
  node_user_domain["Accounts and follows<br/>[userController.js]"]
  node_repo_domain["Repository management<br/>[repoController.js]"]
  node_issue_domain["Issue management<br/>[issueController.js]"]
end

subgraph group_data["Persistence"]
  node_mongo[("MongoDB")]
  node_user_model[("User records<br/>[userModel.js]")]
  node_repo_model[("Repository records<br/>[repoModel.js]")]
  node_issue_model[("Issue records<br/>[issueModel.js]")]
end

subgraph group_cli["Repository CLI"]
  node_cli_entry["CLI command dispatch<br/>[index.js]"]
  node_cli_init["Initialize repository<br/>[init.js]"]
  node_cli_add["Stage files<br/>[add.js]"]
  node_cli_commit["Create commits<br/>[commit.js]"]
  node_cli_push["Push commits<br/>[push.js]"]
  node_cli_pull["Pull commits<br/>[pull.js]"]
  node_cli_revert["Revert commit<br/>[revert.js]"]
  node_aws_config["S3 configuration<br/>[aws-config.js]"]
end

subgraph group_realtime["Live activity"]
  node_socket_backend["Socket event service<br/>[socket.js]"]
  node_socket_client["Socket client<br/>[socket.js]"]
  node_navbar["Activity notifications<br/>[Navbar.jsx]"]
end

node_developer(("Developer"))
node_s3[("AWS S3")]

node_developer -->|"uses"| node_routes_ui
node_routes_ui -->|"routes to"| node_auth_ui
node_routes_ui -->|"routes to"| node_dashboard
node_routes_ui -->|"routes to"| node_repo_create_ui
node_routes_ui -->|"routes to"| node_repo_detail_ui
node_routes_ui -->|"routes to"| node_profile_ui
node_auth_ui -->|"uses session"| node_auth_context
node_routes_ui -->|"checks session"| node_auth_context
node_dashboard -->|"uses endpoint"| node_api_config
node_repo_create_ui -.->|"submits repository"| node_api_routes
node_repo_detail_ui -.->|"requests details and issues"| node_api_routes
node_profile_ui -.->|"requests profile operations"| node_api_routes
node_api_routes -->|"mounts"| node_user_routes
node_api_routes -->|"mounts"| node_repo_routes
node_api_routes -->|"mounts"| node_issue_routes
node_user_routes -->|"dispatches"| node_user_domain
node_repo_routes -->|"dispatches"| node_repo_domain
node_issue_routes -->|"dispatches"| node_issue_domain
node_user_domain -->|"reads and writes"| node_mongo
node_repo_domain -->|"queries"| node_repo_model
node_repo_domain -->|"uses user records"| node_user_model
node_repo_domain -->|"uses issue records"| node_issue_model
node_repo_model -->|"persists"| node_mongo
node_user_model -.->|"persists"| node_mongo
node_issue_domain -->|"loads repository"| node_repo_model
node_issue_domain -->|"creates and updates"| node_issue_model
node_issue_domain -->|"emits issue events"| node_socket_backend
node_cli_entry -->|"dispatches init"| node_cli_init
node_cli_entry -->|"dispatches add"| node_cli_add
node_cli_entry -->|"dispatches commit"| node_cli_commit
node_cli_entry -->|"dispatches push"| node_cli_push
node_cli_entry -->|"dispatches pull"| node_cli_pull
node_cli_entry -->|"dispatches revert"| node_cli_revert
node_cli_push -->|"uses configuration"| node_aws_config
node_cli_pull -->|"uses configuration"| node_aws_config
node_cli_push -->|"uploads commits"| node_s3
node_cli_pull -->|"downloads commits"| node_s3
node_auth_context -->|"connects session"| node_socket_client
node_repo_detail_ui -->|"joins repository room"| node_socket_client
node_navbar -->|"subscribes notifications"| node_socket_client
node_socket_backend -.->|"delivers activity"| node_navbar

click node_routes_ui "https://github.com/hlozaid/githubclone/blob/main/frontend/src/Routes.jsx"
click node_auth_ui "https://github.com/hlozaid/githubclone/blob/main/frontend/src/components/auth/Login.jsx"
click node_dashboard "https://github.com/hlozaid/githubclone/blob/main/frontend/src/components/dashboard/Dashboard.jsx"
click node_repo_create_ui "https://github.com/hlozaid/githubclone/blob/main/frontend/src/components/repo/CreateRepository.jsx"
click node_repo_detail_ui "https://github.com/hlozaid/githubclone/blob/main/frontend/src/components/repo/RepositoryDetails.jsx"
click node_profile_ui "https://github.com/hlozaid/githubclone/blob/main/frontend/src/components/user/Profile.jsx"
click node_auth_context "https://github.com/hlozaid/githubclone/blob/main/frontend/src/authContext.jsx"
click node_api_config "https://github.com/hlozaid/githubclone/blob/main/frontend/src/config.js"
click node_api_routes "https://github.com/hlozaid/githubclone/blob/main/backend/routes/main.router.js"
click node_user_routes "https://github.com/hlozaid/githubclone/blob/main/backend/routes/user.router.js"
click node_repo_routes "https://github.com/hlozaid/githubclone/blob/main/backend/routes/repo.router.js"
click node_issue_routes "https://github.com/hlozaid/githubclone/blob/main/backend/routes/issue.router.js"
click node_user_domain "https://github.com/hlozaid/githubclone/blob/main/backend/controllers/userController.js"
click node_repo_domain "https://github.com/hlozaid/githubclone/blob/main/backend/controllers/repoController.js"
click node_issue_domain "https://github.com/hlozaid/githubclone/blob/main/backend/controllers/issueController.js"
click node_user_model "https://github.com/hlozaid/githubclone/blob/main/backend/models/userModel.js"
click node_repo_model "https://github.com/hlozaid/githubclone/blob/main/backend/models/repoModel.js"
click node_issue_model "https://github.com/hlozaid/githubclone/blob/main/backend/models/issueModel.js"
click node_cli_entry "https://github.com/hlozaid/githubclone/blob/main/backend/index.js"
click node_cli_init "https://github.com/hlozaid/githubclone/blob/main/backend/controllers/init.js"
click node_cli_add "https://github.com/hlozaid/githubclone/blob/main/backend/controllers/add.js"
click node_cli_commit "https://github.com/hlozaid/githubclone/blob/main/backend/controllers/commit.js"
click node_cli_push "https://github.com/hlozaid/githubclone/blob/main/backend/controllers/push.js"
click node_cli_pull "https://github.com/hlozaid/githubclone/blob/main/backend/controllers/pull.js"
click node_cli_revert "https://github.com/hlozaid/githubclone/blob/main/backend/controllers/revert.js"
click node_aws_config "https://github.com/hlozaid/githubclone/blob/main/backend/config/aws-config.js"
click node_socket_backend "https://github.com/hlozaid/githubclone/blob/main/backend/socket.js"
click node_socket_client "https://github.com/hlozaid/githubclone/blob/main/frontend/src/socket.js"
click node_navbar "https://github.com/hlozaid/githubclone/blob/main/frontend/src/components/Navbar.jsx"

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_routes_ui,node_auth_ui,node_dashboard,node_repo_create_ui,node_repo_detail_ui,node_profile_ui,node_auth_context,node_api_config toneBlue
class node_api_routes,node_user_routes,node_repo_routes,node_issue_routes,node_user_domain,node_repo_domain,node_issue_domain,node_s3 toneAmber
class node_mongo,node_user_model,node_repo_model,node_issue_model toneMint
class node_cli_entry,node_cli_init,node_cli_add,node_cli_commit,node_cli_push,node_cli_pull,node_cli_revert,node_aws_config toneRose
class node_socket_backend,node_socket_client,node_navbar,node_developer toneIndigo
```

## Components

### Web experience

- [Page routing](https://github.com/hlozaid/githubclone/blob/main/frontend/src/Routes.jsx): `frontend/src/Routes.jsx`
- [Sign in and signup](https://github.com/hlozaid/githubclone/blob/main/frontend/src/components/auth/Login.jsx): `frontend/src/components/auth/Login.jsx`
- [Repository discovery](https://github.com/hlozaid/githubclone/blob/main/frontend/src/components/dashboard/Dashboard.jsx): `frontend/src/components/dashboard/Dashboard.jsx`
- [Create repository](https://github.com/hlozaid/githubclone/blob/main/frontend/src/components/repo/CreateRepository.jsx): `frontend/src/components/repo/CreateRepository.jsx`
- [Repository and issues](https://github.com/hlozaid/githubclone/blob/main/frontend/src/components/repo/RepositoryDetails.jsx): `frontend/src/components/repo/RepositoryDetails.jsx`
- [Developer profile](https://github.com/hlozaid/githubclone/blob/main/frontend/src/components/user/Profile.jsx): `frontend/src/components/user/Profile.jsx`
- [Session context](https://github.com/hlozaid/githubclone/blob/main/frontend/src/authContext.jsx): `frontend/src/authContext.jsx`
- [API endpoint config](https://github.com/hlozaid/githubclone/blob/main/frontend/src/config.js): `frontend/src/config.js`

### API and domain

- [Express route assembly](https://github.com/hlozaid/githubclone/blob/main/backend/routes/main.router.js): `backend/routes/main.router.js`
- [User endpoints](https://github.com/hlozaid/githubclone/blob/main/backend/routes/user.router.js): `backend/routes/user.router.js`
- [Repository endpoints](https://github.com/hlozaid/githubclone/blob/main/backend/routes/repo.router.js): `backend/routes/repo.router.js`
- [Issue endpoints](https://github.com/hlozaid/githubclone/blob/main/backend/routes/issue.router.js): `backend/routes/issue.router.js`
- [Accounts and follows](https://github.com/hlozaid/githubclone/blob/main/backend/controllers/userController.js): `backend/controllers/userController.js`
- [Repository management](https://github.com/hlozaid/githubclone/blob/main/backend/controllers/repoController.js): `backend/controllers/repoController.js`
- [Issue management](https://github.com/hlozaid/githubclone/blob/main/backend/controllers/issueController.js): `backend/controllers/issueController.js`

### Persistence

- **MongoDB**
- [User records](https://github.com/hlozaid/githubclone/blob/main/backend/models/userModel.js): `backend/models/userModel.js`
- [Repository records](https://github.com/hlozaid/githubclone/blob/main/backend/models/repoModel.js): `backend/models/repoModel.js`
- [Issue records](https://github.com/hlozaid/githubclone/blob/main/backend/models/issueModel.js): `backend/models/issueModel.js`

### Repository CLI

- [CLI command dispatch](https://github.com/hlozaid/githubclone/blob/main/backend/index.js): `backend/index.js`
- [Initialize repository](https://github.com/hlozaid/githubclone/blob/main/backend/controllers/init.js): `backend/controllers/init.js`
- [Stage files](https://github.com/hlozaid/githubclone/blob/main/backend/controllers/add.js): `backend/controllers/add.js`
- [Create commits](https://github.com/hlozaid/githubclone/blob/main/backend/controllers/commit.js): `backend/controllers/commit.js`
- [Push commits](https://github.com/hlozaid/githubclone/blob/main/backend/controllers/push.js): `backend/controllers/push.js`
- [Pull commits](https://github.com/hlozaid/githubclone/blob/main/backend/controllers/pull.js): `backend/controllers/pull.js`
- [Revert commit](https://github.com/hlozaid/githubclone/blob/main/backend/controllers/revert.js): `backend/controllers/revert.js`
- [S3 configuration](https://github.com/hlozaid/githubclone/blob/main/backend/config/aws-config.js): `backend/config/aws-config.js`

### Live activity

- [Socket event service](https://github.com/hlozaid/githubclone/blob/main/backend/socket.js): `backend/socket.js`
- [Socket client](https://github.com/hlozaid/githubclone/blob/main/frontend/src/socket.js): `frontend/src/socket.js`
- [Activity notifications](https://github.com/hlozaid/githubclone/blob/main/frontend/src/components/Navbar.jsx): `frontend/src/components/Navbar.jsx`

### Other components

- **Developer**
- **AWS S3**

## Connections

- Developer → Page routing: uses (evidence: `frontend/src/Routes.jsx`)
- Page routing → Sign in and signup: routes to (evidence: `frontend/src/Routes.jsx`)
- Page routing → Repository discovery: routes to (evidence: `frontend/src/Routes.jsx`)
- Page routing → Create repository: routes to (evidence: `frontend/src/Routes.jsx`)
- Page routing → Repository and issues: routes to (evidence: `frontend/src/Routes.jsx`)
- Page routing → Developer profile: routes to (evidence: `frontend/src/Routes.jsx`)
- Sign in and signup → Session context: uses session (evidence: `frontend/src/components/auth/Login.jsx`)
- Page routing → Session context: checks session (evidence: `frontend/src/Routes.jsx`)
- Repository discovery → API endpoint config: uses endpoint (evidence: `frontend/src/components/dashboard/Dashboard.jsx`)
- Create repository → Express route assembly: submits repository (evidence: `README.md`)
- Repository and issues → Express route assembly: requests details and issues (evidence: `README.md`)
- Developer profile → Express route assembly: requests profile operations (evidence: `README.md`)
- Express route assembly → User endpoints: mounts (evidence: `backend/routes/main.router.js`)
- Express route assembly → Repository endpoints: mounts (evidence: `backend/routes/main.router.js`)
- Express route assembly → Issue endpoints: mounts (evidence: `backend/routes/main.router.js`)
- User endpoints → Accounts and follows: dispatches (evidence: `backend/routes/user.router.js`)
- Repository endpoints → Repository management: dispatches (evidence: `backend/routes/repo.router.js`)
- Issue endpoints → Issue management: dispatches (evidence: `backend/routes/issue.router.js`)
- Accounts and follows → MongoDB: reads and writes (evidence: `backend/controllers/userController.js`)
- Repository management → Repository records: queries (evidence: `backend/controllers/repoController.js`)
- Repository management → User records: uses user records (evidence: `backend/controllers/repoController.js`)
- Repository management → Issue records: uses issue records (evidence: `backend/controllers/repoController.js`)
- Repository records → MongoDB: persists (evidence: `backend/models/repoModel.js`)
- User records → MongoDB: persists
- Issue management → Repository records: loads repository (evidence: `backend/controllers/issueController.js`)
- Issue management → Issue records: creates and updates (evidence: `backend/controllers/issueController.js`)
- Issue management → Socket event service: emits issue events (evidence: `backend/controllers/issueController.js`)
- CLI command dispatch → Initialize repository: dispatches init (evidence: `backend/index.js`)
- CLI command dispatch → Stage files: dispatches add (evidence: `backend/index.js`)
- CLI command dispatch → Create commits: dispatches commit (evidence: `backend/index.js`)
- CLI command dispatch → Push commits: dispatches push (evidence: `backend/index.js`)
- CLI command dispatch → Pull commits: dispatches pull (evidence: `backend/index.js`)
- CLI command dispatch → Revert commit: dispatches revert (evidence: `backend/index.js`)
- Push commits → S3 configuration: uses configuration (evidence: `backend/controllers/push.js`)
- Pull commits → S3 configuration: uses configuration (evidence: `backend/controllers/pull.js`)
- Push commits → AWS S3: uploads commits (evidence: `README.md`)
- Pull commits → AWS S3: downloads commits (evidence: `README.md`)
- Session context → Socket client: connects session (evidence: `frontend/src/authContext.jsx`)
- Repository and issues → Socket client: joins repository room (evidence: `frontend/src/components/repo/RepositoryDetails.jsx`)
- Activity notifications → Socket client: subscribes notifications (evidence: `frontend/src/components/Navbar.jsx`)
- Socket event service → Activity notifications: delivers activity
