# mayconcoutinho/g2 architecture

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

- Interactive diagram: https://gitdiagram.com/mayconcoutinho/g2
- Repository: https://github.com/mayconcoutinho/g2

## Overview

G2 is a React news site: readers browse news by category or general feed, open an article, and view the live section; administrators log in to add, edit, or delete news and update live video/chat. Firebase is the documented data backend. The graph covers the routes and data-fetching flow shown in excerpts and the admin capabilities stated in the README; admin subcomponents and live display implementations are represented at their exact tree paths, but their internal calls were not sampled.

Main entry points: [`src/routes/Routes.jsx`](https://github.com/mayconcoutinho/g2/blob/main/src/routes/Routes.jsx) (Page routing), [`src/services/FireBase/index.jsx`](https://github.com/mayconcoutinho/g2/blob/main/src/services/FireBase/index.jsx) (Firebase operations), [`src/pages/AdminPage/index.jsx`](https://github.com/mayconcoutinho/g2/blob/main/src/pages/AdminPage/index.jsx) (Admin workspace), [`src/Components/Cards/Geral/index.jsx`](https://github.com/mayconcoutinho/g2/blob/main/src/Components/Cards/Geral/index.jsx) (News feed cards)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_app["Application shell"]
  node_app["App and provider<br/>[App.js]"]
  node_routes["Page routing<br/>[Routes.jsx]"]
  node_coord["Navigation helpers<br/>[coordinator.jsx]"]
end

subgraph group_reader["Reader experience"]
  node_home["Home page<br/>[index.jsx]"]
  node_navpage["Category page<br/>[index.jsx]"]
  node_news["Article page<br/>[index.jsx]"]
  node_cards["News feed cards<br/>[index.jsx]"]
  node_general["General feed<br/>[index.jsx]"]
  node_category["Category feed<br/>[index.jsx]"]
  node_live["Live section<br/>[index.jsx]"]
end

subgraph group_admin["Administration"]
  node_adminlogin["Admin login<br/>[index.jsx]"]
  node_token["Credential check<br/>[index.jsx]"]
  node_adminpage["Admin workspace<br/>[index.jsx]"]
  node_add["Add news<br/>[index.jsx]"]
  node_edit["Edit news<br/>[index.jsx]"]
  node_delete["Delete news<br/>[index.jsx]"]
  node_liveedit["Edit live content<br/>[index.jsx]"]
end

subgraph group_data["Data and access"]
  node_context["Shared data context<br/>[useContext.js]"]
  node_firebase["Firebase operations<br/>[index.jsx]"]
  node_store[("Firestore")]
end

node_reader(("Reader"))

node_reader -->|"opens pages"| node_routes
node_routes -->|"routes to"| node_home
node_routes -->|"routes to"| node_navpage
node_routes -->|"routes to"| node_news
node_app -->|"renders"| node_routes
node_app -->|"provides state"| node_context
node_context -->|"fetches news and live data"| node_firebase
node_firebase -->|"reads and writes"| node_store
node_home -.->|"renders feed"| node_cards
node_navpage -.->|"renders feed"| node_cards
node_cards -->|"renders"| node_general
node_cards -->|"renders"| node_category
node_cards -->|"renders"| node_live
node_general -->|"opens article"| node_news
node_category -->|"opens article"| node_news
node_news -->|"reads article data"| node_context
node_routes -->|"routes to"| node_adminlogin
node_routes -->|"routes to"| node_adminpage
node_adminlogin -->|"checks credentials"| node_token
node_token -->|"loads admin credentials"| node_firebase
node_adminpage -->|"uses shared state"| node_context
node_adminpage -.->|"offers publishing"| node_add
node_adminpage -.->|"offers editing"| node_edit
node_adminpage -.->|"offers deletion"| node_delete
node_adminpage -.->|"offers live updates"| node_liveedit
node_add -->|"creates news"| node_firebase
node_edit -->|"updates news"| node_firebase
node_delete -.->|"deletes news"| node_firebase
node_liveedit -->|"updates live data"| node_firebase

click node_app "https://github.com/mayconcoutinho/g2/blob/main/src/App.js"
click node_routes "https://github.com/mayconcoutinho/g2/blob/main/src/routes/Routes.jsx"
click node_coord "https://github.com/mayconcoutinho/g2/blob/main/src/routes/coordinator.jsx"
click node_home "https://github.com/mayconcoutinho/g2/blob/main/src/pages/HomePage/index.jsx"
click node_navpage "https://github.com/mayconcoutinho/g2/blob/main/src/pages/NavPage/index.jsx"
click node_news "https://github.com/mayconcoutinho/g2/blob/main/src/pages/NewsPage/index.jsx"
click node_cards "https://github.com/mayconcoutinho/g2/blob/main/src/Components/Cards/Geral/index.jsx"
click node_general "https://github.com/mayconcoutinho/g2/blob/main/src/Components/Cards/Geral/TodosGenero/index.jsx"
click node_category "https://github.com/mayconcoutinho/g2/blob/main/src/Components/Cards/Geral/GeneroNoticia/index.jsx"
click node_live "https://github.com/mayconcoutinho/g2/blob/main/src/Components/Cards/AoVivo/index.jsx"
click node_context "https://github.com/mayconcoutinho/g2/blob/main/src/global/context/useContext.js"
click node_firebase "https://github.com/mayconcoutinho/g2/blob/main/src/services/FireBase/index.jsx"
click node_adminlogin "https://github.com/mayconcoutinho/g2/blob/main/src/pages/LoginPage/index.jsx"
click node_token "https://github.com/mayconcoutinho/g2/blob/main/src/hooks/token/index.jsx"
click node_adminpage "https://github.com/mayconcoutinho/g2/blob/main/src/pages/AdminPage/index.jsx"
click node_add "https://github.com/mayconcoutinho/g2/blob/main/src/Components/Admin/AdicionarPost/index.jsx"
click node_edit "https://github.com/mayconcoutinho/g2/blob/main/src/Components/Admin/Editar/index.jsx"
click node_delete "https://github.com/mayconcoutinho/g2/blob/main/src/Components/Admin/Excluir/index.jsx"
click node_liveedit "https://github.com/mayconcoutinho/g2/blob/main/src/Components/Admin/AoVivo/index.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_app,node_routes,node_coord toneBlue
class node_home,node_navpage,node_news,node_cards,node_general,node_category,node_live toneAmber
class node_adminlogin,node_token,node_adminpage,node_add,node_edit,node_delete,node_liveedit toneMint
class node_context,node_firebase,node_store toneRose
class node_reader toneIndigo
```

## Components

### Application shell

- [App and provider](https://github.com/mayconcoutinho/g2/blob/main/src/App.js): `src/App.js`
- [Page routing](https://github.com/mayconcoutinho/g2/blob/main/src/routes/Routes.jsx): `src/routes/Routes.jsx`
- [Navigation helpers](https://github.com/mayconcoutinho/g2/blob/main/src/routes/coordinator.jsx): `src/routes/coordinator.jsx`

### Reader experience

- [Home page](https://github.com/mayconcoutinho/g2/blob/main/src/pages/HomePage/index.jsx): `src/pages/HomePage/index.jsx`
- [Category page](https://github.com/mayconcoutinho/g2/blob/main/src/pages/NavPage/index.jsx): `src/pages/NavPage/index.jsx`
- [Article page](https://github.com/mayconcoutinho/g2/blob/main/src/pages/NewsPage/index.jsx): `src/pages/NewsPage/index.jsx`
- [News feed cards](https://github.com/mayconcoutinho/g2/blob/main/src/Components/Cards/Geral/index.jsx): `src/Components/Cards/Geral/index.jsx`
- [General feed](https://github.com/mayconcoutinho/g2/blob/main/src/Components/Cards/Geral/TodosGenero/index.jsx): `src/Components/Cards/Geral/TodosGenero/index.jsx`
- [Category feed](https://github.com/mayconcoutinho/g2/blob/main/src/Components/Cards/Geral/GeneroNoticia/index.jsx): `src/Components/Cards/Geral/GeneroNoticia/index.jsx`
- [Live section](https://github.com/mayconcoutinho/g2/blob/main/src/Components/Cards/AoVivo/index.jsx): `src/Components/Cards/AoVivo/index.jsx`

### Administration

- [Admin login](https://github.com/mayconcoutinho/g2/blob/main/src/pages/LoginPage/index.jsx): `src/pages/LoginPage/index.jsx`
- [Credential check](https://github.com/mayconcoutinho/g2/blob/main/src/hooks/token/index.jsx): `src/hooks/token/index.jsx`
- [Admin workspace](https://github.com/mayconcoutinho/g2/blob/main/src/pages/AdminPage/index.jsx): `src/pages/AdminPage/index.jsx`
- [Add news](https://github.com/mayconcoutinho/g2/blob/main/src/Components/Admin/AdicionarPost/index.jsx): `src/Components/Admin/AdicionarPost/index.jsx`
- [Edit news](https://github.com/mayconcoutinho/g2/blob/main/src/Components/Admin/Editar/index.jsx): `src/Components/Admin/Editar/index.jsx`
- [Delete news](https://github.com/mayconcoutinho/g2/blob/main/src/Components/Admin/Excluir/index.jsx): `src/Components/Admin/Excluir/index.jsx`
- [Edit live content](https://github.com/mayconcoutinho/g2/blob/main/src/Components/Admin/AoVivo/index.jsx): `src/Components/Admin/AoVivo/index.jsx`

### Data and access

- [Shared data context](https://github.com/mayconcoutinho/g2/blob/main/src/global/context/useContext.js): `src/global/context/useContext.js`
- [Firebase operations](https://github.com/mayconcoutinho/g2/blob/main/src/services/FireBase/index.jsx): `src/services/FireBase/index.jsx`
- **Firestore**

### Other components

- **Reader**

## Connections

- Reader → Page routing: opens pages (evidence: `src/routes/Routes.jsx`)
- Page routing → Home page: routes to (evidence: `src/routes/Routes.jsx`)
- Page routing → Category page: routes to (evidence: `src/routes/Routes.jsx`)
- Page routing → Article page: routes to (evidence: `src/routes/Routes.jsx`)
- App and provider → Page routing: renders (evidence: `src/App.js`)
- App and provider → Shared data context: provides state (evidence: `src/App.js`)
- Shared data context → Firebase operations: fetches news and live data (evidence: `src/global/context/useContext.js`)
- Firebase operations → Firestore: reads and writes (evidence: `src/services/FireBase/index.jsx`)
- Home page → News feed cards: renders feed
- Category page → News feed cards: renders feed
- News feed cards → General feed: renders (evidence: `src/Components/Cards/Geral/index.jsx`)
- News feed cards → Category feed: renders (evidence: `src/Components/Cards/Geral/index.jsx`)
- News feed cards → Live section: renders (evidence: `src/Components/Cards/index.jsx`)
- General feed → Article page: opens article (evidence: `src/Components/Cards/Geral/TodosGenero/index.jsx`)
- Category feed → Article page: opens article (evidence: `src/Components/Cards/Geral/GeneroNoticia/index.jsx`)
- Article page → Shared data context: reads article data (evidence: `src/pages/NewsPage/index.jsx`)
- Page routing → Admin login: routes to (evidence: `src/routes/Routes.jsx`)
- Page routing → Admin workspace: routes to (evidence: `src/routes/Routes.jsx`)
- Admin login → Credential check: checks credentials (evidence: `src/pages/LoginPage/index.jsx`)
- Credential check → Firebase operations: loads admin credentials (evidence: `src/hooks/token/index.jsx`)
- Admin workspace → Shared data context: uses shared state (evidence: `src/pages/AdminPage/index.jsx`)
- Admin workspace → Add news: offers publishing
- Admin workspace → Edit news: offers editing
- Admin workspace → Delete news: offers deletion
- Admin workspace → Edit live content: offers live updates
- Add news → Firebase operations: creates news (evidence: `src/Components/Admin/AdicionarPost/index.jsx`)
- Edit news → Firebase operations: updates news (evidence: `src/Components/Admin/Editar/index.jsx`)
- Delete news → Firebase operations: deletes news
- Edit live content → Firebase operations: updates live data (evidence: `src/Components/Admin/AoVivo/index.jsx`)
