# shara986/gogreenai architecture

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

- Interactive diagram: https://gitdiagram.com/shara986/gogreenai
- Repository: https://github.com/shara986/gogreenai

## Overview

GoGreen AI is a nursery-management platform: customers browse plant and category listings, while nursery owners maintain nursery details and plant inventory; authentication and role-based access govern those experiences. The React app routes users to pages, whose service modules call the Spring REST API. The API exposes authentication, catalog, nursery, and administration capabilities, with services implementing business operations over persistent data. The README documents the broader API and role capabilities; several controllers and service implementations were not sampled, so uncertain internal links are left out or marked unverified.

Main entry points: [`backend/src/main/java/com/gogreen/api`](https://github.com/shara986/gogreenai/tree/main/backend/src/main/java/com/gogreen/api) (Spring REST API), [`frontend/src/App.js`](https://github.com/shara986/gogreenai/blob/main/frontend/src/App.js) (Route application), [`backend/src/main/java/com/gogreen/api/service/impl/AuthServiceImpl.java`](https://github.com/shara986/gogreenai/blob/main/backend/src/main/java/com/gogreen/api/service/impl/AuthServiceImpl.java) (Authentication operations), [`backend/src/main/java/com/gogreen/api/service/PlantService.java`](https://github.com/shara986/gogreenai/blob/main/backend/src/main/java/com/gogreen/api/service/PlantService.java) (Plant operations)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_frontend["React application"]
  node_app["Route application<br/>[App.js]"]
  node_api_client["HTTP client<br/>[apiClient.js]"]
end

subgraph group_identity["Identity and access"]
  node_auth_context["Auth context<br/>[AuthContext.jsx]"]
  node_auth_pages["Sign-in and registration"]
  node_role_routes["Protected routes"]
  node_auth_controller["Authentication endpoints"]
  node_auth_service["Authentication operations"]
  node_security["JWT security"]
  node_email["Email service"]
end

subgraph group_catalog["Nursery catalog"]
  node_customer_catalog["Customer catalog"]
  node_owner_inventory["Owner inventory"]
  node_frontend_services["Catalog services"]
  node_plant_controller["Plant endpoints"]
  node_plant_service["Plant operations<br/>[PlantService.java]"]
  node_catalog_endpoints["Public catalog endpoints"]
  node_category_ops["Category operations"]
  node_nursery_ops["Nursery operations"]
end

subgraph group_backend["API and administration"]
  node_api["Spring REST API"]
  node_admin_ops["Administration"]
end

subgraph group_persistence["Persistence"]
  node_repositories["Data repositories"]
  node_entities["Domain entities"]
  node_mysql[("MySQL database")]
end

node_user(("Platform user"))

node_user -->|"uses"| node_app
node_app -->|"provides auth"| node_auth_context
node_app -->|"routes to"| node_auth_pages
node_app -->|"guards routes"| node_role_routes
node_app -->|"routes to"| node_customer_catalog
node_app -->|"routes to"| node_owner_inventory
node_auth_context -->|"requests through"| node_api_client
node_customer_catalog -->|"requests through"| node_frontend_services
node_owner_inventory -->|"requests through"| node_frontend_services
node_frontend_services -->|"sends requests"| node_api_client
node_api_client -.->|"calls REST API"| node_api
node_api -.->|"routes auth"| node_auth_controller
node_auth_controller -->|"delegates to"| node_auth_service
node_auth_service -->|"sends mail"| node_email
node_auth_service -->|"reads and writes"| node_repositories
node_auth_service -->|"issues JWT"| node_security
node_api -.->|"routes plants"| node_plant_controller
node_plant_controller -->|"delegates to"| node_plant_service
node_api -.->|"serves catalog"| node_catalog_endpoints
node_api -.->|"exposes categories"| node_category_ops
node_api -.->|"exposes nursery"| node_nursery_ops
node_api -.->|"provides admin"| node_admin_ops
node_plant_service -.->|"uses data access"| node_repositories
node_auth_service -->|"manages users"| node_entities
node_plant_service -.->|"manages plants"| node_entities
node_repositories -.->|"persists records"| node_mysql

click node_app "https://github.com/shara986/gogreenai/blob/main/frontend/src/App.js"
click node_auth_context "https://github.com/shara986/gogreenai/blob/main/frontend/src/context/AuthContext.jsx"
click node_auth_pages "https://github.com/shara986/gogreenai/tree/main/frontend/src/pages/auth"
click node_role_routes "https://github.com/shara986/gogreenai/tree/main/frontend/src/routes"
click node_customer_catalog "https://github.com/shara986/gogreenai/tree/main/frontend/src/pages/customer"
click node_owner_inventory "https://github.com/shara986/gogreenai/tree/main/frontend/src/pages/nursery"
click node_frontend_services "https://github.com/shara986/gogreenai/tree/main/frontend/src/services"
click node_api_client "https://github.com/shara986/gogreenai/blob/main/frontend/src/services/apiClient.js"
click node_api "https://github.com/shara986/gogreenai/tree/main/backend/src/main/java/com/gogreen/api"
click node_auth_controller "https://github.com/shara986/gogreenai/blob/main/backend/src/main/java/com/gogreen/api/controller/AuthController.java"
click node_auth_service "https://github.com/shara986/gogreenai/blob/main/backend/src/main/java/com/gogreen/api/service/impl/AuthServiceImpl.java"
click node_security "https://github.com/shara986/gogreenai/tree/main/backend/src/main/java/com/gogreen/api/security"
click node_plant_controller "https://github.com/shara986/gogreenai/blob/main/backend/src/main/java/com/gogreen/api/controller/NurseryPlantController.java"
click node_plant_service "https://github.com/shara986/gogreenai/blob/main/backend/src/main/java/com/gogreen/api/service/PlantService.java"
click node_catalog_endpoints "https://github.com/shara986/gogreenai/tree/main/backend/src/main/java/com/gogreen/api/controller"
click node_category_ops "https://github.com/shara986/gogreenai/tree/main/backend/src/main/java/com/gogreen/api/service"
click node_nursery_ops "https://github.com/shara986/gogreenai/tree/main/backend/src/main/java/com/gogreen/api/service"
click node_admin_ops "https://github.com/shara986/gogreenai/tree/main/backend/src/main/java/com/gogreen/api/controller"
click node_email "https://github.com/shara986/gogreenai/blob/main/backend/src/main/java/com/gogreen/api/service/impl/EmailServiceImpl.java"
click node_repositories "https://github.com/shara986/gogreenai/tree/main/backend/src/main/java/com/gogreen/api/repository"
click node_entities "https://github.com/shara986/gogreenai/tree/main/backend/src/main/java/com/gogreen/api/entity"

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_api_client,node_user toneBlue
class node_auth_context,node_auth_pages,node_role_routes,node_auth_controller,node_auth_service,node_security,node_email toneAmber
class node_customer_catalog,node_owner_inventory,node_frontend_services,node_plant_controller,node_plant_service,node_catalog_endpoints,node_category_ops,node_nursery_ops toneMint
class node_api,node_admin_ops toneRose
class node_repositories,node_entities,node_mysql toneIndigo
```

## Components

### React application

- [Route application](https://github.com/shara986/gogreenai/blob/main/frontend/src/App.js): `frontend/src/App.js`
- [HTTP client](https://github.com/shara986/gogreenai/blob/main/frontend/src/services/apiClient.js): `frontend/src/services/apiClient.js`

### Identity and access

- [Auth context](https://github.com/shara986/gogreenai/blob/main/frontend/src/context/AuthContext.jsx): `frontend/src/context/AuthContext.jsx`
- [Sign-in and registration](https://github.com/shara986/gogreenai/tree/main/frontend/src/pages/auth): `frontend/src/pages/auth`
- [Protected routes](https://github.com/shara986/gogreenai/tree/main/frontend/src/routes): `frontend/src/routes`
- [Authentication endpoints](https://github.com/shara986/gogreenai/blob/main/backend/src/main/java/com/gogreen/api/controller/AuthController.java): `backend/src/main/java/com/gogreen/api/controller/AuthController.java`
- [Authentication operations](https://github.com/shara986/gogreenai/blob/main/backend/src/main/java/com/gogreen/api/service/impl/AuthServiceImpl.java): `backend/src/main/java/com/gogreen/api/service/impl/AuthServiceImpl.java`
- [JWT security](https://github.com/shara986/gogreenai/tree/main/backend/src/main/java/com/gogreen/api/security): `backend/src/main/java/com/gogreen/api/security`
- [Email service](https://github.com/shara986/gogreenai/blob/main/backend/src/main/java/com/gogreen/api/service/impl/EmailServiceImpl.java): `backend/src/main/java/com/gogreen/api/service/impl/EmailServiceImpl.java`

### Nursery catalog

- [Customer catalog](https://github.com/shara986/gogreenai/tree/main/frontend/src/pages/customer): `frontend/src/pages/customer`
- [Owner inventory](https://github.com/shara986/gogreenai/tree/main/frontend/src/pages/nursery): `frontend/src/pages/nursery`
- [Catalog services](https://github.com/shara986/gogreenai/tree/main/frontend/src/services): `frontend/src/services`
- [Plant endpoints](https://github.com/shara986/gogreenai/blob/main/backend/src/main/java/com/gogreen/api/controller/NurseryPlantController.java): `backend/src/main/java/com/gogreen/api/controller/NurseryPlantController.java`
- [Plant operations](https://github.com/shara986/gogreenai/blob/main/backend/src/main/java/com/gogreen/api/service/PlantService.java): `backend/src/main/java/com/gogreen/api/service/PlantService.java`
- [Public catalog endpoints](https://github.com/shara986/gogreenai/tree/main/backend/src/main/java/com/gogreen/api/controller): `backend/src/main/java/com/gogreen/api/controller`
- [Category operations](https://github.com/shara986/gogreenai/tree/main/backend/src/main/java/com/gogreen/api/service): `backend/src/main/java/com/gogreen/api/service`
- [Nursery operations](https://github.com/shara986/gogreenai/tree/main/backend/src/main/java/com/gogreen/api/service): `backend/src/main/java/com/gogreen/api/service`

### API and administration

- [Spring REST API](https://github.com/shara986/gogreenai/tree/main/backend/src/main/java/com/gogreen/api): `backend/src/main/java/com/gogreen/api`
- [Administration](https://github.com/shara986/gogreenai/tree/main/backend/src/main/java/com/gogreen/api/controller): `backend/src/main/java/com/gogreen/api/controller`

### Persistence

- [Data repositories](https://github.com/shara986/gogreenai/tree/main/backend/src/main/java/com/gogreen/api/repository): `backend/src/main/java/com/gogreen/api/repository`
- [Domain entities](https://github.com/shara986/gogreenai/tree/main/backend/src/main/java/com/gogreen/api/entity): `backend/src/main/java/com/gogreen/api/entity`
- **MySQL database**

### Other components

- **Platform user**

## Connections

- Platform user → Route application: uses (evidence: `frontend/src/App.js`)
- Route application → Auth context: provides auth (evidence: `frontend/src/App.js`)
- Route application → Sign-in and registration: routes to (evidence: `frontend/src/App.js`)
- Route application → Protected routes: guards routes (evidence: `frontend/src/App.js`)
- Route application → Customer catalog: routes to (evidence: `frontend/src/App.js`)
- Route application → Owner inventory: routes to (evidence: `frontend/src/App.js`)
- Auth context → HTTP client: requests through (evidence: `frontend/src/context/AuthContext.jsx`)
- Customer catalog → Catalog services: requests through (evidence: `frontend/src/pages/customer/PlantListing.jsx`)
- Owner inventory → Catalog services: requests through (evidence: `frontend/src/pages/nursery/PlantManagement.jsx`)
- Catalog services → HTTP client: sends requests (evidence: `frontend/src/services/plantService.js`)
- HTTP client → Spring REST API: calls REST API (evidence: `frontend/src/services/apiClient.js`)
- Spring REST API → Authentication endpoints: routes auth (evidence: `backend/src/main/java/com/gogreen/api/controller/AuthController.java`)
- Authentication endpoints → Authentication operations: delegates to (evidence: `backend/src/main/java/com/gogreen/api/controller/AuthController.java`)
- Authentication operations → Email service: sends mail (evidence: `backend/src/main/java/com/gogreen/api/service/impl/AuthServiceImpl.java`)
- Authentication operations → Data repositories: reads and writes (evidence: `backend/src/main/java/com/gogreen/api/service/impl/AuthServiceImpl.java`)
- Authentication operations → JWT security: issues JWT (evidence: `backend/src/main/java/com/gogreen/api/service/impl/AuthServiceImpl.java`)
- Spring REST API → Plant endpoints: routes plants (evidence: `backend/src/main/java/com/gogreen/api/controller/NurseryPlantController.java`)
- Plant endpoints → Plant operations: delegates to (evidence: `backend/src/main/java/com/gogreen/api/controller/NurseryPlantController.java`)
- Spring REST API → Public catalog endpoints: serves catalog (evidence: `backend/src/main/java/com/gogreen/api/controller/AuthController.java`)
- Spring REST API → Category operations: exposes categories (evidence: `README.md`)
- Spring REST API → Nursery operations: exposes nursery (evidence: `README.md`)
- Spring REST API → Administration: provides admin (evidence: `backend/src/main/java/com/gogreen/api/controller/AuthController.java`)
- Plant operations → Data repositories: uses data access
- Authentication operations → Domain entities: manages users (evidence: `backend/src/main/java/com/gogreen/api/service/impl/AuthServiceImpl.java`)
- Plant operations → Domain entities: manages plants (evidence: `backend/src/main/java/com/gogreen/api/service/PlantService.java`)
- Data repositories → MySQL database: persists records (evidence: `README.md`)
