# ahmedmohamed17/blog-frontend architecture

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

- Interactive diagram: https://gitdiagram.com/ahmedmohamed17/blog-frontend
- Repository: https://github.com/ahmedmohamed17/blog-frontend

## Overview

This is a React front end for a post-publishing application. Users browse posts, filter by category or author, and open post details; signed-in users can create and manage posts and edit their profiles. The router connects these screens, while shared components render post lists and author details. API calls and asset URLs indicate a separate backend and asset host. The excerpts show several API interactions; for other modules, relationships are limited to routing or references listed in the source index.

Main entry points: [`src/index.js`](https://github.com/ahmedmohamed17/blog-frontend/blob/main/src/index.js) (Route entry), [`src/Context/usercontext.js`](https://github.com/ahmedmohamed17/blog-frontend/blob/main/src/Context/usercontext.js) (User session state), [`src/pages/Dashboard.jsx`](https://github.com/ahmedmohamed17/blog-frontend/blob/main/src/pages/Dashboard.jsx) (My posts), [`src/pages/DeletePost.jsx`](https://github.com/ahmedmohamed17/blog-frontend/blob/main/src/pages/DeletePost.jsx) (Delete post)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_navigation["App navigation"]
  node_router["Route entry<br/>[index.js]"]
  node_layout["Page layout<br/>[Layout.jsx]"]
  node_header["Navigation header<br/>[Header.jsx]"]
  node_footer["Footer<br/>[Footer.jsx]"]
  node_error["Error screen<br/>[ErrorPage.jsx]"]
  node_loader["Loading indicator<br/>[loader.jsx]"]
end

subgraph group_discovery["Post discovery"]
  node_home["Home page<br/>[Home.jsx]"]
  node_posts["Post feed<br/>[Posts.jsx]"]
  node_postitem["Post card<br/>[PostItem.jsx]"]
  node_postauthor["Post author detail<br/>[PostAuthor.jsx]"]
  node_authors["Author directory<br/>[Authors.jsx]"]
  node_authorposts["Author posts<br/>[AuthorPosts.jsx]"]
  node_categoryposts["Category posts<br/>[CategoryPosts.jsx]"]
  node_postdetail["Post detail<br/>[PostDetail.jsx]"]
end

subgraph group_publishing["Post management"]
  node_createpost["Create post<br/>[CreatePost.jsx]"]
  node_dashboard["My posts<br/>[Dashboard.jsx]"]
  node_editpost["Edit post<br/>[EditPost.jsx]"]
  node_deletepost["Delete post<br/>[DeletePost.jsx]"]
end

subgraph group_accounts["Accounts"]
  node_register["Registration<br/>[Register.jsx]"]
  node_login["Login<br/>[Login.jsx]"]
  node_logout["Logout<br/>[Logout.jsx]"]
  node_profile["User profile<br/>[UserProfile.jsx]"]
  node_userstate["User session state<br/>[usercontext.js]"]
end

node_visitor(("Visitor"))
node_api["Backend API"]
node_assets["Asset host"]

node_visitor -->|"opens app"| node_router
node_router -->|"mounts routes"| node_layout
node_router -->|"routes to"| node_home
node_router -->|"routes to"| node_postdetail
node_router -->|"routes to"| node_register
node_router -->|"routes to"| node_login
node_router -->|"routes to"| node_profile
node_router -->|"routes to"| node_authors
node_router -->|"routes to"| node_createpost
node_router -->|"routes to"| node_categoryposts
node_router -->|"routes to"| node_authorposts
node_router -->|"routes to"| node_dashboard
node_router -->|"routes to"| node_editpost
node_router -->|"routes to"| node_deletepost
node_router -->|"routes to"| node_logout
node_router -->|"error route"| node_error
node_layout -->|"renders"| node_header
node_layout -->|"renders"| node_footer
node_header -->|"reads session"| node_userstate
node_home -->|"renders"| node_posts
node_posts -->|"fetches posts"| node_api
node_posts -->|"renders cards"| node_postitem
node_postitem -->|"renders author"| node_postauthor
node_postauthor -->|"fetches author"| node_api
node_authors -->|"fetches authors"| node_api
node_authorposts -->|"fetches posts"| node_api
node_authorposts -->|"renders cards"| node_postitem
node_categoryposts -->|"renders cards"| node_postitem
node_createpost -->|"reads session"| node_userstate
node_createpost -->|"submits post"| node_api
node_dashboard -->|"reads session"| node_userstate
node_dashboard -->|"fetches posts"| node_api
node_dashboard -->|"offers deletion"| node_deletepost
node_editpost -->|"reads session"| node_userstate
node_editpost -->|"updates post"| node_api
node_deletepost -->|"reads session"| node_userstate
node_deletepost -->|"deletes post"| node_api
node_postdetail -->|"renders author"| node_postauthor
node_postdetail -->|"offers deletion"| node_deletepost
node_postdetail -->|"loads post"| node_api
node_login -->|"sets session"| node_userstate
node_logout -->|"clears session"| node_userstate
node_profile -->|"reads session"| node_userstate
node_profile -->|"updates account"| node_api
node_posts -->|"shows while loading"| node_loader
node_authorposts -->|"shows while loading"| node_loader
node_authors -->|"shows while loading"| node_loader
node_dashboard -->|"shows while loading"| node_loader

click node_router "https://github.com/ahmedmohamed17/blog-frontend/blob/main/src/index.js"
click node_layout "https://github.com/ahmedmohamed17/blog-frontend/blob/main/src/components/Layout.jsx"
click node_header "https://github.com/ahmedmohamed17/blog-frontend/blob/main/src/components/Header.jsx"
click node_footer "https://github.com/ahmedmohamed17/blog-frontend/blob/main/src/components/Footer.jsx"
click node_error "https://github.com/ahmedmohamed17/blog-frontend/blob/main/src/pages/ErrorPage.jsx"
click node_home "https://github.com/ahmedmohamed17/blog-frontend/blob/main/src/pages/Home.jsx"
click node_posts "https://github.com/ahmedmohamed17/blog-frontend/blob/main/src/components/Posts.jsx"
click node_postitem "https://github.com/ahmedmohamed17/blog-frontend/blob/main/src/components/PostItem.jsx"
click node_postauthor "https://github.com/ahmedmohamed17/blog-frontend/blob/main/src/components/PostAuthor.jsx"
click node_authors "https://github.com/ahmedmohamed17/blog-frontend/blob/main/src/pages/Authors.jsx"
click node_authorposts "https://github.com/ahmedmohamed17/blog-frontend/blob/main/src/pages/AuthorPosts.jsx"
click node_categoryposts "https://github.com/ahmedmohamed17/blog-frontend/blob/main/src/pages/CategoryPosts.jsx"
click node_postdetail "https://github.com/ahmedmohamed17/blog-frontend/blob/main/src/pages/PostDetail.jsx"
click node_createpost "https://github.com/ahmedmohamed17/blog-frontend/blob/main/src/pages/CreatePost.jsx"
click node_dashboard "https://github.com/ahmedmohamed17/blog-frontend/blob/main/src/pages/Dashboard.jsx"
click node_editpost "https://github.com/ahmedmohamed17/blog-frontend/blob/main/src/pages/EditPost.jsx"
click node_deletepost "https://github.com/ahmedmohamed17/blog-frontend/blob/main/src/pages/DeletePost.jsx"
click node_register "https://github.com/ahmedmohamed17/blog-frontend/blob/main/src/pages/Register.jsx"
click node_login "https://github.com/ahmedmohamed17/blog-frontend/blob/main/src/pages/Login.jsx"
click node_logout "https://github.com/ahmedmohamed17/blog-frontend/blob/main/src/pages/Logout.jsx"
click node_profile "https://github.com/ahmedmohamed17/blog-frontend/blob/main/src/pages/UserProfile.jsx"
click node_userstate "https://github.com/ahmedmohamed17/blog-frontend/blob/main/src/Context/usercontext.js"
click node_loader "https://github.com/ahmedmohamed17/blog-frontend/blob/main/src/components/loader.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_router,node_layout,node_header,node_footer,node_error,node_loader toneBlue
class node_home,node_posts,node_postitem,node_postauthor,node_authors,node_authorposts,node_categoryposts,node_postdetail toneAmber
class node_createpost,node_dashboard,node_editpost,node_deletepost,node_api toneMint
class node_register,node_login,node_logout,node_profile,node_userstate toneRose
class node_visitor,node_assets toneIndigo
```

## Components

### App navigation

- [Route entry](https://github.com/ahmedmohamed17/blog-frontend/blob/main/src/index.js): `src/index.js`
- [Page layout](https://github.com/ahmedmohamed17/blog-frontend/blob/main/src/components/Layout.jsx): `src/components/Layout.jsx`
- [Navigation header](https://github.com/ahmedmohamed17/blog-frontend/blob/main/src/components/Header.jsx): `src/components/Header.jsx`
- [Footer](https://github.com/ahmedmohamed17/blog-frontend/blob/main/src/components/Footer.jsx): `src/components/Footer.jsx`
- [Error screen](https://github.com/ahmedmohamed17/blog-frontend/blob/main/src/pages/ErrorPage.jsx): `src/pages/ErrorPage.jsx`
- [Loading indicator](https://github.com/ahmedmohamed17/blog-frontend/blob/main/src/components/loader.jsx): `src/components/loader.jsx`

### Post discovery

- [Home page](https://github.com/ahmedmohamed17/blog-frontend/blob/main/src/pages/Home.jsx): `src/pages/Home.jsx`
- [Post feed](https://github.com/ahmedmohamed17/blog-frontend/blob/main/src/components/Posts.jsx): `src/components/Posts.jsx`
- [Post card](https://github.com/ahmedmohamed17/blog-frontend/blob/main/src/components/PostItem.jsx): `src/components/PostItem.jsx`
- [Post author detail](https://github.com/ahmedmohamed17/blog-frontend/blob/main/src/components/PostAuthor.jsx): `src/components/PostAuthor.jsx`
- [Author directory](https://github.com/ahmedmohamed17/blog-frontend/blob/main/src/pages/Authors.jsx): `src/pages/Authors.jsx`
- [Author posts](https://github.com/ahmedmohamed17/blog-frontend/blob/main/src/pages/AuthorPosts.jsx): `src/pages/AuthorPosts.jsx`
- [Category posts](https://github.com/ahmedmohamed17/blog-frontend/blob/main/src/pages/CategoryPosts.jsx): `src/pages/CategoryPosts.jsx`
- [Post detail](https://github.com/ahmedmohamed17/blog-frontend/blob/main/src/pages/PostDetail.jsx): `src/pages/PostDetail.jsx`

### Post management

- [Create post](https://github.com/ahmedmohamed17/blog-frontend/blob/main/src/pages/CreatePost.jsx): `src/pages/CreatePost.jsx`
- [My posts](https://github.com/ahmedmohamed17/blog-frontend/blob/main/src/pages/Dashboard.jsx): `src/pages/Dashboard.jsx`
- [Edit post](https://github.com/ahmedmohamed17/blog-frontend/blob/main/src/pages/EditPost.jsx): `src/pages/EditPost.jsx`
- [Delete post](https://github.com/ahmedmohamed17/blog-frontend/blob/main/src/pages/DeletePost.jsx): `src/pages/DeletePost.jsx`

### Accounts

- [Registration](https://github.com/ahmedmohamed17/blog-frontend/blob/main/src/pages/Register.jsx): `src/pages/Register.jsx`
- [Login](https://github.com/ahmedmohamed17/blog-frontend/blob/main/src/pages/Login.jsx): `src/pages/Login.jsx`
- [Logout](https://github.com/ahmedmohamed17/blog-frontend/blob/main/src/pages/Logout.jsx): `src/pages/Logout.jsx`
- [User profile](https://github.com/ahmedmohamed17/blog-frontend/blob/main/src/pages/UserProfile.jsx): `src/pages/UserProfile.jsx`
- [User session state](https://github.com/ahmedmohamed17/blog-frontend/blob/main/src/Context/usercontext.js): `src/Context/usercontext.js`

### Other components

- **Visitor**
- **Backend API**
- **Asset host**

## Connections

- Visitor → Route entry: opens app (evidence: `src/index.js`)
- Route entry → Page layout: mounts routes (evidence: `src/index.js`)
- Route entry → Home page: routes to (evidence: `src/index.js`)
- Route entry → Post detail: routes to (evidence: `src/index.js`)
- Route entry → Registration: routes to (evidence: `src/index.js`)
- Route entry → Login: routes to (evidence: `src/index.js`)
- Route entry → User profile: routes to (evidence: `src/index.js`)
- Route entry → Author directory: routes to (evidence: `src/index.js`)
- Route entry → Create post: routes to (evidence: `src/index.js`)
- Route entry → Category posts: routes to (evidence: `src/index.js`)
- Route entry → Author posts: routes to (evidence: `src/index.js`)
- Route entry → My posts: routes to (evidence: `src/index.js`)
- Route entry → Edit post: routes to (evidence: `src/index.js`)
- Route entry → Delete post: routes to (evidence: `src/index.js`)
- Route entry → Logout: routes to (evidence: `src/index.js`)
- Route entry → Error screen: error route (evidence: `src/index.js`)
- Page layout → Navigation header: renders (evidence: `src/components/Layout.jsx`)
- Page layout → Footer: renders (evidence: `src/components/Layout.jsx`)
- Navigation header → User session state: reads session (evidence: `src/components/Header.jsx`)
- Home page → Post feed: renders (evidence: `src/pages/Home.jsx`)
- Post feed → Backend API: fetches posts (evidence: `src/components/Posts.jsx`)
- Post feed → Post card: renders cards (evidence: `src/components/Posts.jsx`)
- Post card → Post author detail: renders author (evidence: `src/components/PostItem.jsx`)
- Post author detail → Backend API: fetches author (evidence: `src/components/PostAuthor.jsx`)
- Author directory → Backend API: fetches authors (evidence: `src/pages/Authors.jsx`)
- Author posts → Backend API: fetches posts (evidence: `src/pages/AuthorPosts.jsx`)
- Author posts → Post card: renders cards (evidence: `src/pages/AuthorPosts.jsx`)
- Category posts → Post card: renders cards (evidence: `src/pages/CategoryPosts.jsx`)
- Create post → User session state: reads session (evidence: `src/pages/CreatePost.jsx`)
- Create post → Backend API: submits post (evidence: `src/pages/CreatePost.jsx`)
- My posts → User session state: reads session (evidence: `src/pages/Dashboard.jsx`)
- My posts → Backend API: fetches posts (evidence: `src/pages/Dashboard.jsx`)
- My posts → Delete post: offers deletion (evidence: `src/pages/Dashboard.jsx`)
- Edit post → User session state: reads session (evidence: `src/pages/EditPost.jsx`)
- Edit post → Backend API: updates post (evidence: `src/pages/EditPost.jsx`)
- Delete post → User session state: reads session (evidence: `src/pages/DeletePost.jsx`)
- Delete post → Backend API: deletes post (evidence: `src/pages/DeletePost.jsx`)
- Post detail → Post author detail: renders author (evidence: `src/pages/PostDetail.jsx`)
- Post detail → Delete post: offers deletion (evidence: `src/pages/PostDetail.jsx`)
- Post detail → Backend API: loads post (evidence: `src/pages/PostDetail.jsx`)
- Login → User session state: sets session (evidence: `src/pages/Login.jsx`)
- Logout → User session state: clears session (evidence: `src/pages/Logout.jsx`)
- User profile → User session state: reads session (evidence: `src/pages/UserProfile.jsx`)
- User profile → Backend API: updates account (evidence: `src/pages/UserProfile.jsx`)
- Post feed → Loading indicator: shows while loading (evidence: `src/components/Posts.jsx`)
- Author posts → Loading indicator: shows while loading (evidence: `src/pages/AuthorPosts.jsx`)
- Author directory → Loading indicator: shows while loading (evidence: `src/pages/Authors.jsx`)
- My posts → Loading indicator: shows while loading (evidence: `src/pages/Dashboard.jsx`)
