# geeky-biz/strapi-plugin-components-usage-info architecture

> Architecture diagram of the GitHub repository geeky-biz/strapi-plugin-components-usage-info, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-07-06). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/geeky-biz/strapi-plugin-components-usage-info
- Repository: https://github.com/geeky-biz/strapi-plugin-components-usage-info

## Overview

1. **What this repository is**
   - This is a **Strapi v5 plugin** named `strapi-plugin-components-usage-info`.
   - Its job is to help an operator **find where a given component is actually used with data** across the CMS, including nested component usage and locales.

2. **Top-level split: admin UI vs server logic**
   - The repo is divided into two clear halves:
     - `admin/` for the **Strapi admin panel extension**.
     - `server/` for the **plugin backend inside the Strapi runtime**.
   - This is the main architectural boundary: the admin side is presentation and interaction; the server side owns schema inspection and data lookup.

3. **Admin subsystem**
   - `admin/src/pages/App.jsx` and `admin/src/pages/HomePage.jsx` appear to define the plugin’s screen(s) in the Strapi admin.
   - `admin/src/components/Initializer.jsx` and `Loader.jsx` suggest a lightweight bootstrap/loading experience while plugin state or data is being prepared.
   - `PluginIcon.jsx` and `TooltipIconButton.jsx` are UI affordances used to integrate into the Strapi admin experience.
   - `admin/src/translations/en.json` and `utils/getTranslation.js` show the UI is localized and likely uses Strapi’s translation hooks.

4. **Admin runtime boundary**
   - The admin code is a **React-based extension of the Strapi dashboard**, not a standalone app.
   - It likely renders a component selector and results view, but does not directly compute usage itself; instead it calls the plugin backend.

5. **Server subsystem**
   - The backend plugin entry points are `server/src/index.js`, `register.js`, `bootstrap.js`, and `destroy.js`.
   - These files match Strapi plugin lifecycle hooks:
     - `register` for plugin registration/wiring,
     - `bootstrap` for startup initialization,
     - `destroy` for cleanup.
   - `server/src/config/index.js`, `middlewares/index.js`, `policies/index.js`, `routes/index.js`, `controllers/index.js`, and `services/index.js` are the standard Strapi plugin module registries.

6. **Core business logic boundary**
   - `server/src/services/service.js` is the most likely place where the actual **component-usage discovery logic** lives.
   - `server/src/controllers/componentsInfoController.js` is the API layer that exposes that logic to the admin UI.
   - This separation implies a classic Strapi pattern:
     - controller = request/response handling,
     - service = domain logic and data traversal.

7. **Expected data flow**
   - The admin UI likely:
     1. loads the available components,
     2. lets the user select one,
     3. calls a backend route,
     4. receives collections/records where that component is populated.
   - The backend likely inspects Strapi schemas/content types and queries entries to determine usage.
   - The README confirms the backend considers:
     - nested components recursively,
     - locales,
     - only published records.

8. **Strapi metadata and content model access**
   - `server/src/content-types/index.js` indicates the plugin may define or expose plugin-specific content types, or it may simply follow Strapi’s expected plugin structure with no substantial models.
   - More importantly, the server must have access to Strapi’s content-type registry to resolve where components appear across collections and nested structures.

9. **Routing and access control**
   - `server/src/routes/index.js` and `server/src/policies/index.js` imply the backend API is gated through Strapi’s routing/policy system.
   - `server/src/middlewares/index.js` exists as part of the plugin scaffold, suggesting request processing can be extended, though nothing in the file tree suggests heavy middleware use.

10. **Plugin identity and integration**
   - `admin/src/pluginId.js` is the admin-side plugin identifier used to bind the UI into Strapi’s plugin system.
   - `server/src/config/index.js` likely supplies the plugin’s server-side configuration defaults.
   - Together they let the plugin be enabled in `config/plugin.js` as described in the README.

11. **Static assets and packaging**
   - `images/` contains documentation/screenshot assets, not runtime logic.
   - Root-level `package.json` and `package-lock.json` show this is packaged as an npm-distributable Strapi plugin.
   - The presence of `.prettierrc`, `.eslintrc`-style ignore files, and `jsconfig.json` files indicates a JavaScript/React/Node codebase with editor tooling support.

12. **Architectural summary for diagramming**
   - Draw this as a **Strapi plugin with two major planes**:
     - **Admin UI plane**: React pages/components in `admin/` rendering the component-selection experience.
     - **Backend API plane**: Strapi plugin routes/controllers/services in `server/` performing schema traversal and published-entry lookup.
   - The key interaction is: **admin UI → plugin API → Strapi content metadata/data → response back to admin UI**.
   - The plugin’s distinguishing logic is the recursive detection of component usage across nested components and localized published content.

Main entry points: [`admin/src/pages/HomePage.jsx`](https://github.com/geeky-biz/strapi-plugin-components-usage-info/blob/main/admin/src/pages/HomePage.jsx) (Home page), [`server/src/index.js`](https://github.com/geeky-biz/strapi-plugin-components-usage-info/blob/main/server/src/index.js) (Server entry), [`server/src/routes/index.js`](https://github.com/geeky-biz/strapi-plugin-components-usage-info/blob/main/server/src/routes/index.js) (Routes), [`server/src/services/service.js`](https://github.com/geeky-biz/strapi-plugin-components-usage-info/blob/main/server/src/services/service.js) (Usage service)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_admin["Admin UI"]
  node_admin_index["Plugin entry<br/>admin bootstrap<br/>[index.js]"]
  node_admin_app["App shell<br/>admin page<br/>[App.jsx]"]
  node_admin_home["Home page<br/>admin page<br/>[HomePage.jsx]"]
  node_admin_init(("Initializer<br/>ui bootstrap<br/>[Initializer.jsx]"))
  node_admin_loader(("Loader<br/>ui feedback<br/>[Loader.jsx]"))
  node_admin_icon(("Plugin icon<br/>ui icon<br/>[PluginIcon.jsx]"))
  node_admin_tooltip(("Tooltip button<br/>ui control"))
  node_admin_i18n["Translations<br/>localization<br/>[en.json]"]
  node_admin_tutils(("Translate util<br/>i18n helper<br/>[getTranslation.js]"))
  node_admin_pluginid(("Plugin ID<br/>[pluginId.js]"))
end

subgraph group_server["Backend API"]
  node_server_index["Server entry<br/>plugin entry<br/>[index.js]"]
  node_server_register(("Register<br/>lifecycle hook<br/>[register.js]"))
  node_server_bootstrap(("Bootstrap<br/>lifecycle hook<br/>[bootstrap.js]"))
  node_server_destroy(("Destroy<br/>lifecycle hook<br/>[destroy.js]"))
  node_server_routes["Routes<br/>[index.js]"]
  node_server_controller["Usage controller<br/>api controller"]
  node_server_service["Usage service<br/>domain service<br/>[service.js]"]
  node_server_config(("Config<br/>[index.js]"))
  node_server_policies(("Policies<br/>access control<br/>[index.js]"))
  node_server_contenttypes[("Content types<br/>plugin models<br/>[index.js]")]
  node_server_middlewares(("Middlewares<br/>request pipeline<br/>[index.js]"))
end

node_admin_index -->|"mounts"| node_admin_app
node_admin_app -->|"initializes"| node_admin_init
node_admin_init -->|"renders"| node_admin_home
node_admin_home -->|"uses"| node_admin_loader
node_admin_home -->|"uses"| node_admin_tooltip
node_admin_home -->|"brands"| node_admin_icon
node_admin_home -->|"localizes"| node_admin_tutils
node_admin_tutils -->|"reads"| node_admin_i18n
node_admin_index -->|"identifies"| node_admin_pluginid
node_admin_home -.->|"calls API"| node_server_routes
node_server_index -->|"wires"| node_server_register
node_server_index -->|"wires"| node_server_bootstrap
node_server_index -->|"wires"| node_server_destroy
node_server_index -->|"exposes"| node_server_routes
node_server_routes -->|"guards"| node_server_policies
node_server_routes -->|"dispatches"| node_server_controller
node_server_controller -->|"delegates"| node_server_service
node_server_service -->|"inspects"| node_server_contenttypes
node_server_service -->|"uses"| node_server_config
node_server_index -->|"includes"| node_server_middlewares

click node_admin_index "https://github.com/geeky-biz/strapi-plugin-components-usage-info/blob/main/admin/src/index.js"
click node_admin_app "https://github.com/geeky-biz/strapi-plugin-components-usage-info/blob/main/admin/src/pages/App.jsx"
click node_admin_home "https://github.com/geeky-biz/strapi-plugin-components-usage-info/blob/main/admin/src/pages/HomePage.jsx"
click node_admin_init "https://github.com/geeky-biz/strapi-plugin-components-usage-info/blob/main/admin/src/components/Initializer.jsx"
click node_admin_loader "https://github.com/geeky-biz/strapi-plugin-components-usage-info/blob/main/admin/src/components/Loader.jsx"
click node_admin_icon "https://github.com/geeky-biz/strapi-plugin-components-usage-info/blob/main/admin/src/components/PluginIcon.jsx"
click node_admin_tooltip "https://github.com/geeky-biz/strapi-plugin-components-usage-info/blob/main/admin/src/components/TooltipIconButton.jsx"
click node_admin_i18n "https://github.com/geeky-biz/strapi-plugin-components-usage-info/blob/main/admin/src/translations/en.json"
click node_admin_tutils "https://github.com/geeky-biz/strapi-plugin-components-usage-info/blob/main/admin/src/utils/getTranslation.js"
click node_admin_pluginid "https://github.com/geeky-biz/strapi-plugin-components-usage-info/blob/main/admin/src/pluginId.js"
click node_server_index "https://github.com/geeky-biz/strapi-plugin-components-usage-info/blob/main/server/src/index.js"
click node_server_register "https://github.com/geeky-biz/strapi-plugin-components-usage-info/blob/main/server/src/register.js"
click node_server_bootstrap "https://github.com/geeky-biz/strapi-plugin-components-usage-info/blob/main/server/src/bootstrap.js"
click node_server_destroy "https://github.com/geeky-biz/strapi-plugin-components-usage-info/blob/main/server/src/destroy.js"
click node_server_routes "https://github.com/geeky-biz/strapi-plugin-components-usage-info/blob/main/server/src/routes/index.js"
click node_server_controller "https://github.com/geeky-biz/strapi-plugin-components-usage-info/blob/main/server/src/controllers/componentsInfoController.js"
click node_server_service "https://github.com/geeky-biz/strapi-plugin-components-usage-info/blob/main/server/src/services/service.js"
click node_server_config "https://github.com/geeky-biz/strapi-plugin-components-usage-info/blob/main/server/src/config/index.js"
click node_server_policies "https://github.com/geeky-biz/strapi-plugin-components-usage-info/blob/main/server/src/policies/index.js"
click node_server_contenttypes "https://github.com/geeky-biz/strapi-plugin-components-usage-info/blob/main/server/src/content-types/index.js"
click node_server_middlewares "https://github.com/geeky-biz/strapi-plugin-components-usage-info/blob/main/server/src/middlewares/index.js"

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_admin_index,node_admin_app,node_admin_home,node_admin_init,node_admin_loader,node_admin_icon,node_admin_tooltip,node_admin_i18n,node_admin_tutils,node_admin_pluginid toneBlue
class node_server_index,node_server_register,node_server_bootstrap,node_server_destroy,node_server_routes,node_server_controller,node_server_service,node_server_config,node_server_policies,node_server_contenttypes,node_server_middlewares toneAmber
```

## Components

### Admin UI

React-based Strapi admin extension for selecting a component and viewing usage results.

- [Plugin entry](https://github.com/geeky-biz/strapi-plugin-components-usage-info/blob/main/admin/src/index.js): admin bootstrap · Registers the admin extension inside Strapi. · `admin/src/index.js`
- [App shell](https://github.com/geeky-biz/strapi-plugin-components-usage-info/blob/main/admin/src/pages/App.jsx): admin page · Top-level admin page wrapper for the plugin UI. · `admin/src/pages/App.jsx`
- [Home page](https://github.com/geeky-biz/strapi-plugin-components-usage-info/blob/main/admin/src/pages/HomePage.jsx): admin page · Main screen where component usage is explored. · `admin/src/pages/HomePage.jsx`
- [Initializer](https://github.com/geeky-biz/strapi-plugin-components-usage-info/blob/main/admin/src/components/Initializer.jsx): ui bootstrap · Prepares plugin state before the main view renders. · `admin/src/components/Initializer.jsx`
- [Loader](https://github.com/geeky-biz/strapi-plugin-components-usage-info/blob/main/admin/src/components/Loader.jsx): ui feedback · Loading state shown while data or plugin state is being prepared. · `admin/src/components/Loader.jsx`
- [Plugin icon](https://github.com/geeky-biz/strapi-plugin-components-usage-info/blob/main/admin/src/components/PluginIcon.jsx): ui icon · Visual identity for the plugin in the Strapi admin. · `admin/src/components/PluginIcon.jsx`
- [Tooltip button](https://github.com/geeky-biz/strapi-plugin-components-usage-info/blob/main/admin/src/components/TooltipIconButton.jsx): ui control · Reusable admin button with tooltip behavior. · `admin/src/components/TooltipIconButton.jsx`
- [Translations](https://github.com/geeky-biz/strapi-plugin-components-usage-info/blob/main/admin/src/translations/en.json): localization · Admin-side translation catalog for UI text. · `admin/src/translations/en.json`
- [Translate util](https://github.com/geeky-biz/strapi-plugin-components-usage-info/blob/main/admin/src/utils/getTranslation.js): i18n helper · Helper for resolving localized admin strings. · `admin/src/utils/getTranslation.js`
- [Plugin ID](https://github.com/geeky-biz/strapi-plugin-components-usage-info/blob/main/admin/src/pluginId.js): plugin identity · Admin-side identifier used to bind the extension into Strapi. · `admin/src/pluginId.js`

### Backend API

Strapi plugin runtime that registers routes and resolves component usage from content data.

- [Server entry](https://github.com/geeky-biz/strapi-plugin-components-usage-info/blob/main/server/src/index.js): plugin entry · Main backend plugin export and wiring point. · `server/src/index.js`
- [Register](https://github.com/geeky-biz/strapi-plugin-components-usage-info/blob/main/server/src/register.js): lifecycle hook · Plugin registration and runtime wiring. · `server/src/register.js`
- [Bootstrap](https://github.com/geeky-biz/strapi-plugin-components-usage-info/blob/main/server/src/bootstrap.js): lifecycle hook · Startup initialization for the plugin runtime. · `server/src/bootstrap.js`
- [Destroy](https://github.com/geeky-biz/strapi-plugin-components-usage-info/blob/main/server/src/destroy.js): lifecycle hook · Cleanup hook for plugin shutdown. · `server/src/destroy.js`
- [Routes](https://github.com/geeky-biz/strapi-plugin-components-usage-info/blob/main/server/src/routes/index.js): api routes · HTTP route definitions for the plugin API. · `server/src/routes/index.js`
- [Usage controller](https://github.com/geeky-biz/strapi-plugin-components-usage-info/blob/main/server/src/controllers/componentsInfoController.js): api controller · Handles requests from the admin UI and returns usage results. · `server/src/controllers/componentsInfoController.js`
- [Usage service](https://github.com/geeky-biz/strapi-plugin-components-usage-info/blob/main/server/src/services/service.js): domain service · Core logic for finding where components are used in content. · `server/src/services/service.js`
- [Config](https://github.com/geeky-biz/strapi-plugin-components-usage-info/blob/main/server/src/config/index.js): plugin config · Server-side plugin configuration defaults. · `server/src/config/index.js`
- [Policies](https://github.com/geeky-biz/strapi-plugin-components-usage-info/blob/main/server/src/policies/index.js): access control · Policy registry protecting plugin routes. · `server/src/policies/index.js`
- [Content types](https://github.com/geeky-biz/strapi-plugin-components-usage-info/blob/main/server/src/content-types/index.js): plugin models · Plugin content-type registry scaffold or definitions. · `server/src/content-types/index.js`
- [Middlewares](https://github.com/geeky-biz/strapi-plugin-components-usage-info/blob/main/server/src/middlewares/index.js): request pipeline · Optional plugin middleware registry. · `server/src/middlewares/index.js`

## Connections

- Plugin entry → App shell: mounts · The admin entry mounts the plugin UI shell.
- App shell → Initializer: initializes · The app shell prepares state before showing content.
- Initializer → Home page: renders · Initializer leads into the primary home screen.
- Home page → Loader: uses · Home view shows loading feedback during fetches.
- Home page → Tooltip button: uses · Home view reuses icon button controls.
- Home page → Plugin icon: brands · The plugin icon provides admin-side identity.
- Home page → Translate util: localizes · Home UI resolves translated strings.
- Translate util → Translations: reads · Translation helper reads the locale catalog.
- Plugin entry → Plugin ID: identifies · The plugin entry uses the shared plugin identifier.
- Home page → Routes: calls API · The admin screen fetches component-usage data from the backend.
- Server entry → Register: wires · Backend plugin entry exposes lifecycle hooks.
- Server entry → Bootstrap: wires · Backend plugin entry exposes startup initialization.
- Server entry → Destroy: wires · Backend plugin entry exposes shutdown cleanup.
- Server entry → Routes: exposes · Backend plugin registers its HTTP routes.
- Routes → Policies: guards · Routes are protected by plugin policies.
- Routes → Usage controller: dispatches · Route handlers forward requests to the controller.
- Usage controller → Usage service: delegates · Controller delegates component-usage discovery to the service.
- Usage service → Content types: inspects · Service resolves component placement against content model metadata.
- Usage service → Config: uses · Service can read plugin configuration during lookup.
- Server entry → Middlewares: includes · Backend plugin includes the middleware registry scaffold.
