# joaohenriquedv/marketmind architecture

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

- Interactive diagram: https://gitdiagram.com/joaohenriquedv/marketmind
- Repository: https://github.com/joaohenriquedv/marketmind

## Overview

MarketMind is a business-management and financial-insights application. Users sign in, manage businesses and products, then view dashboard indicators and alerts; administrators manage users and businesses. The React app calls an Express API backed by MySQL, with shared financial calculations for user and admin views. The tree also shows chatbot and report-generation capabilities. No README was provided, so relationships and feature coverage are based on the source index and excerpts; chatbot-to-service and report-server wiring are not established by the shown evidence.

Main entry points: [`front/src/App.jsx`](https://github.com/joaohenriquedv/marketmind/blob/main/front/src/App.jsx) (App navigation), [`front/src/api.js`](https://github.com/joaohenriquedv/marketmind/blob/main/front/src/api.js) (API client), [`back/server.js`](https://github.com/joaohenriquedv/marketmind/blob/main/back/server.js) (Express server), [`back/db.js`](https://github.com/joaohenriquedv/marketmind/blob/main/back/db.js) (Application database)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_web["Web application"]
  node_app["App navigation<br/>[App.jsx]"]
  node_api_client["API client<br/>[api.js]"]
  node_login["Sign-in<br/>[login.jsx]"]
  node_signup["Registration<br/>[cadastro.jsx]"]
  node_business_setup["Business setup<br/>[empresa.jsx]"]
  node_dashboard_ui["Dashboard<br/>[dashboard.jsx]"]
  node_product_ui["Product management<br/>[produto.jsx]"]
  node_alerts_ui["Alerts<br/>[alertas.jsx]"]
  node_selector["Business selector<br/>[seletorneg.jsx]"]
  node_profile["Profile<br/>[perfil.jsx]"]
  node_plans["Plans<br/>[planos.jsx]"]
  node_admin_ui["Admin console<br/>[admin.jsx]"]
end

subgraph group_api["Core API"]
  node_http_server["Express server<br/>[server.js]"]
  node_users_routes["User routes<br/>[usuarios.js]"]
  node_business_routes["Business and products<br/>[negocios.js]"]
  node_admin_routes["Admin routes<br/>[admin.js]"]
  node_dashboard_routes["Dashboard routes<br/>[dashboard.js]"]
  node_auth["Token verification<br/>[verificarToken.js]"]
  node_mysql[("Application database<br/>[db.js]")]
end

subgraph group_analytics["Business insights"]
  node_indicators["Financial indicators<br/>[indicadores.js]"]
end

subgraph group_extras["Assistant and reports"]
  node_report_modal["Report builder"]
  node_pdf["PDF generator<br/>[relatorioPdf.js]"]
  node_chat_ui["Chat assistant UI<br/>[chatbot.jsx]"]
  node_chat_service["Chat service<br/>[server.js]"]
  node_report_server["Report server"]
end

node_user(("User"))
node_admin_actor(("Administrator"))

node_user -->|"uses"| node_app
node_admin_actor -->|"uses"| node_app
node_app -->|"renders"| node_login
node_app -->|"renders"| node_signup
node_app -->|"renders"| node_business_setup
node_app -->|"renders"| node_dashboard_ui
node_app -->|"renders"| node_product_ui
node_app -->|"renders"| node_alerts_ui
node_app -->|"renders"| node_profile
node_app -->|"renders"| node_plans
node_app -->|"renders"| node_admin_ui
node_app -->|"renders"| node_chat_ui
node_dashboard_ui -->|"requests data"| node_api_client
node_product_ui -->|"requests data"| node_api_client
node_alerts_ui -->|"requests data"| node_api_client
node_profile -->|"updates profile"| node_api_client
node_admin_ui -->|"admin requests"| node_api_client
node_report_modal -->|"loads business data"| node_api_client
node_report_modal -->|"generates PDF"| node_pdf
node_api_client -->|"HTTP requests"| node_http_server
node_http_server -->|"mounts routes"| node_users_routes
node_http_server -->|"mounts routes"| node_business_routes
node_http_server -->|"mounts routes"| node_admin_routes
node_http_server -->|"mounts routes"| node_dashboard_routes
node_business_routes -->|"guards requests"| node_auth
node_users_routes -->|"guards requests"| node_auth
node_dashboard_routes -->|"guards requests"| node_auth
node_admin_routes -->|"guards requests"| node_auth
node_users_routes -->|"reads and writes"| node_mysql
node_business_routes -->|"reads and writes"| node_mysql
node_admin_routes -->|"reads and writes"| node_mysql
node_dashboard_routes -->|"reads data"| node_mysql
node_admin_routes -->|"aggregates metrics"| node_indicators
node_dashboard_routes -->|"calculates metrics"| node_indicators
node_indicators -->|"reads product data"| node_mysql
node_chat_ui -.->|"may call"| node_chat_service

click node_app "https://github.com/joaohenriquedv/marketmind/blob/main/front/src/App.jsx"
click node_api_client "https://github.com/joaohenriquedv/marketmind/blob/main/front/src/api.js"
click node_login "https://github.com/joaohenriquedv/marketmind/blob/main/front/src/components/login/login.jsx"
click node_signup "https://github.com/joaohenriquedv/marketmind/blob/main/front/src/components/cadastro/cadastro.jsx"
click node_business_setup "https://github.com/joaohenriquedv/marketmind/blob/main/front/src/components/empresa/empresa.jsx"
click node_dashboard_ui "https://github.com/joaohenriquedv/marketmind/blob/main/front/src/components/dashboard/dashboard.jsx"
click node_product_ui "https://github.com/joaohenriquedv/marketmind/blob/main/front/src/components/produto/produto.jsx"
click node_alerts_ui "https://github.com/joaohenriquedv/marketmind/blob/main/front/src/components/alertas.jsx"
click node_selector "https://github.com/joaohenriquedv/marketmind/blob/main/front/src/components/seletorneg.jsx"
click node_profile "https://github.com/joaohenriquedv/marketmind/blob/main/front/src/components/perfil/perfil.jsx"
click node_plans "https://github.com/joaohenriquedv/marketmind/blob/main/front/src/components/planos/planos.jsx"
click node_admin_ui "https://github.com/joaohenriquedv/marketmind/blob/main/front/src/components/admin/admin.jsx"
click node_report_modal "https://github.com/joaohenriquedv/marketmind/blob/main/front/src/components/NovoRelatorioModal.jsx"
click node_pdf "https://github.com/joaohenriquedv/marketmind/blob/main/front/src/utils/relatorioPdf.js"
click node_chat_ui "https://github.com/joaohenriquedv/marketmind/blob/main/front/src/chatbot/chatbot.jsx"
click node_chat_service "https://github.com/joaohenriquedv/marketmind/blob/main/chat_ia/server.js"
click node_http_server "https://github.com/joaohenriquedv/marketmind/blob/main/back/server.js"
click node_users_routes "https://github.com/joaohenriquedv/marketmind/blob/main/back/routes/usuarios.js"
click node_business_routes "https://github.com/joaohenriquedv/marketmind/blob/main/back/routes/negocios.js"
click node_admin_routes "https://github.com/joaohenriquedv/marketmind/blob/main/back/routes/admin.js"
click node_dashboard_routes "https://github.com/joaohenriquedv/marketmind/blob/main/back/routes/dashboard.js"
click node_auth "https://github.com/joaohenriquedv/marketmind/blob/main/back/middlewares/verificarToken.js"
click node_indicators "https://github.com/joaohenriquedv/marketmind/blob/main/back/lib/indicadores.js"
click node_mysql "https://github.com/joaohenriquedv/marketmind/blob/main/back/db.js"
click node_report_server "https://github.com/joaohenriquedv/marketmind/blob/main/back/server-relatorio.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_app,node_api_client,node_login,node_signup,node_business_setup,node_dashboard_ui,node_product_ui,node_alerts_ui,node_selector,node_profile,node_plans,node_admin_ui,node_user toneBlue
class node_http_server,node_users_routes,node_business_routes,node_admin_routes,node_dashboard_routes,node_auth,node_mysql toneAmber
class node_indicators toneMint
class node_report_modal,node_pdf,node_chat_ui,node_chat_service,node_report_server toneRose
class node_admin_actor toneIndigo
```

## Components

### Web application

- [App navigation](https://github.com/joaohenriquedv/marketmind/blob/main/front/src/App.jsx): `front/src/App.jsx`
- [API client](https://github.com/joaohenriquedv/marketmind/blob/main/front/src/api.js): `front/src/api.js`
- [Sign-in](https://github.com/joaohenriquedv/marketmind/blob/main/front/src/components/login/login.jsx): `front/src/components/login/login.jsx`
- [Registration](https://github.com/joaohenriquedv/marketmind/blob/main/front/src/components/cadastro/cadastro.jsx): `front/src/components/cadastro/cadastro.jsx`
- [Business setup](https://github.com/joaohenriquedv/marketmind/blob/main/front/src/components/empresa/empresa.jsx): `front/src/components/empresa/empresa.jsx`
- [Dashboard](https://github.com/joaohenriquedv/marketmind/blob/main/front/src/components/dashboard/dashboard.jsx): `front/src/components/dashboard/dashboard.jsx`
- [Product management](https://github.com/joaohenriquedv/marketmind/blob/main/front/src/components/produto/produto.jsx): `front/src/components/produto/produto.jsx`
- [Alerts](https://github.com/joaohenriquedv/marketmind/blob/main/front/src/components/alertas.jsx): `front/src/components/alertas.jsx`
- [Business selector](https://github.com/joaohenriquedv/marketmind/blob/main/front/src/components/seletorneg.jsx): `front/src/components/seletorneg.jsx`
- [Profile](https://github.com/joaohenriquedv/marketmind/blob/main/front/src/components/perfil/perfil.jsx): `front/src/components/perfil/perfil.jsx`
- [Plans](https://github.com/joaohenriquedv/marketmind/blob/main/front/src/components/planos/planos.jsx): `front/src/components/planos/planos.jsx`
- [Admin console](https://github.com/joaohenriquedv/marketmind/blob/main/front/src/components/admin/admin.jsx): `front/src/components/admin/admin.jsx`

### Core API

- [Express server](https://github.com/joaohenriquedv/marketmind/blob/main/back/server.js): `back/server.js`
- [User routes](https://github.com/joaohenriquedv/marketmind/blob/main/back/routes/usuarios.js): `back/routes/usuarios.js`
- [Business and products](https://github.com/joaohenriquedv/marketmind/blob/main/back/routes/negocios.js): `back/routes/negocios.js`
- [Admin routes](https://github.com/joaohenriquedv/marketmind/blob/main/back/routes/admin.js): `back/routes/admin.js`
- [Dashboard routes](https://github.com/joaohenriquedv/marketmind/blob/main/back/routes/dashboard.js): `back/routes/dashboard.js`
- [Token verification](https://github.com/joaohenriquedv/marketmind/blob/main/back/middlewares/verificarToken.js): `back/middlewares/verificarToken.js`
- [Application database](https://github.com/joaohenriquedv/marketmind/blob/main/back/db.js): `back/db.js`

### Business insights

- [Financial indicators](https://github.com/joaohenriquedv/marketmind/blob/main/back/lib/indicadores.js): `back/lib/indicadores.js`

### Assistant and reports

- [Report builder](https://github.com/joaohenriquedv/marketmind/blob/main/front/src/components/NovoRelatorioModal.jsx): `front/src/components/NovoRelatorioModal.jsx`
- [PDF generator](https://github.com/joaohenriquedv/marketmind/blob/main/front/src/utils/relatorioPdf.js): `front/src/utils/relatorioPdf.js`
- [Chat assistant UI](https://github.com/joaohenriquedv/marketmind/blob/main/front/src/chatbot/chatbot.jsx): `front/src/chatbot/chatbot.jsx`
- [Chat service](https://github.com/joaohenriquedv/marketmind/blob/main/chat_ia/server.js): `chat_ia/server.js`
- [Report server](https://github.com/joaohenriquedv/marketmind/blob/main/back/server-relatorio.js): `back/server-relatorio.js`

### Other components

- **User**
- **Administrator**

## Connections

- User → App navigation: uses
- Administrator → App navigation: uses
- App navigation → Sign-in: renders (evidence: `front/src/App.jsx`)
- App navigation → Registration: renders (evidence: `front/src/App.jsx`)
- App navigation → Business setup: renders (evidence: `front/src/App.jsx`)
- App navigation → Dashboard: renders (evidence: `front/src/App.jsx`)
- App navigation → Product management: renders (evidence: `front/src/App.jsx`)
- App navigation → Alerts: renders (evidence: `front/src/App.jsx`)
- App navigation → Profile: renders (evidence: `front/src/App.jsx`)
- App navigation → Plans: renders (evidence: `front/src/App.jsx`)
- App navigation → Admin console: renders (evidence: `front/src/App.jsx`)
- App navigation → Chat assistant UI: renders (evidence: `front/src/App.jsx`)
- Dashboard → API client: requests data (evidence: `front/src/components/dashboard/dashboard.jsx`)
- Product management → API client: requests data (evidence: `front/src/components/produto/produto.jsx`)
- Alerts → API client: requests data (evidence: `front/src/components/alertas.jsx`)
- Profile → API client: updates profile (evidence: `front/src/components/perfil/perfil.jsx`)
- Admin console → API client: admin requests (evidence: `front/src/components/admin/admin.jsx`)
- Report builder → API client: loads business data (evidence: `front/src/components/NovoRelatorioModal.jsx`)
- Report builder → PDF generator: generates PDF (evidence: `front/src/components/NovoRelatorioModal.jsx`)
- API client → Express server: HTTP requests (evidence: `front/src/api.js`)
- Express server → User routes: mounts routes (evidence: `back/server.js`)
- Express server → Business and products: mounts routes (evidence: `back/server.js`)
- Express server → Admin routes: mounts routes (evidence: `back/server.js`)
- Express server → Dashboard routes: mounts routes (evidence: `back/server.js`)
- Business and products → Token verification: guards requests (evidence: `back/routes/negocios.js`)
- User routes → Token verification: guards requests (evidence: `back/routes/usuarios.js`)
- Dashboard routes → Token verification: guards requests (evidence: `back/routes/dashboard.js`)
- Admin routes → Token verification: guards requests (evidence: `back/routes/admin.js`)
- User routes → Application database: reads and writes (evidence: `back/routes/usuarios.js`)
- Business and products → Application database: reads and writes (evidence: `back/routes/negocios.js`)
- Admin routes → Application database: reads and writes (evidence: `back/routes/admin.js`)
- Dashboard routes → Application database: reads data (evidence: `back/routes/dashboard.js`)
- Admin routes → Financial indicators: aggregates metrics (evidence: `back/routes/admin.js`)
- Dashboard routes → Financial indicators: calculates metrics (evidence: `back/routes/dashboard.js`)
- Financial indicators → Application database: reads product data (evidence: `back/lib/indicadores.js`)
- Chat assistant UI → Chat service: may call
