# qrzaldemir/ecochatbot-ma architecture

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

- Interactive diagram: https://gitdiagram.com/qrzaldemir/ecochatbot-ma
- Repository: https://github.com/qrzaldemir/ecochatbot-ma

## Overview

EcoChatBot-MA is a configurable digital customer-service platform: customers enter through messaging channels, select a configured service menu, provide information through its flow, and are routed to a responsible agent for resolution. The web panel supports live service and administration, alongside reporting, campaigns, AI, audio, and other channel integrations. Paths and links reflect the tree and README; sampled code confirms login handling, while detailed wiring for most subsystems was not sampled.

Main entry points: [`backend/app/services/bot_service.py`](https://github.com/qrzaldemir/ecochatbot-ma/blob/main/backend/app/services/bot_service.py) (Bot workflow), [`backend/app/main.py`](https://github.com/qrzaldemir/ecochatbot-ma/blob/main/backend/app/main.py) (FastAPI application), [`frontend/src/app/app.component.ts`](https://github.com/qrzaldemir/ecochatbot-ma/blob/main/frontend/src/app/app.component.ts) (Angular panel), [`backend/app/routers/auths_routers.py`](https://github.com/qrzaldemir/ecochatbot-ma/blob/main/backend/app/routers/auths_routers.py) (Authentication routes)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_panel["Web panel"]
  node_webapp["Angular panel<br/>[app.component.ts]"]
  node_adminfeatures["Admin and chat<br/>[admin.routes.ts]"]
  node_frontservices["Panel API services"]
  node_authfront["Session and login<br/>[auth.service.ts]"]
end

subgraph group_api["API and security"]
  node_api["FastAPI application<br/>[main.py]"]
  node_authrouter["Authentication routes<br/>[auths_routers.py]"]
  node_authservice["JWT and password security<br/>[auth_service.py]"]
  node_database[("PostgreSQL<br/>[database.py]")]
  node_webhooks["Webhook and message routes<br/>[webhook_routers.py]"]
end

subgraph group_service["Service workflow"]
  node_bots["Bot workflow<br/>[bot_service.py]"]
  node_flows["Bot handlers"]
  node_attendance["Service handling"]
  node_configuration["Channels and departments<br/>[canal_service.py]"]
  node_campaigns["Campaigns and reporting"]
  node_ai["AI assistance"]
end

subgraph group_integrations["Channels and integrations"]
  node_integrations["Channel integrations"]
  node_audio["Audio and speech<br/>[audio_service.py]"]
end

node_customer(("Customer"))
node_agent(("Attendant"))
node_admin(("Administrator"))
node_messaging(("Messaging channel"))

node_admin -->|"uses panel"| node_webapp
node_agent -->|"handles conversations"| node_webapp
node_webapp -->|"renders routes"| node_adminfeatures
node_adminfeatures -->|"uses services"| node_frontservices
node_frontservices -->|"sends API requests"| node_api
node_webapp -->|"starts login"| node_authfront
node_authfront -->|"posts credentials"| node_authrouter
node_api -->|"registers routes"| node_authrouter
node_authrouter -->|"queries user"| node_database
node_authrouter -->|"verifies and signs"| node_authservice
node_customer -->|"sends message"| node_messaging
node_messaging -.->|"delivers inbound event"| node_webhooks
node_webhooks -->|"dispatches message"| node_bots
node_bots -->|"routes interaction"| node_flows
node_bots -->|"opens service"| node_attendance
node_bots -.->|"uses configured channels"| node_configuration
node_attendance -->|"presents conversation"| node_agent
node_bots -.->|"sends channel replies"| node_integrations
node_campaigns -.->|"broadcasts messages"| node_integrations
node_bots -.->|"requests assistance"| node_ai
node_api -->|"registers domain routes"| node_campaigns
node_api -->|"registers audio routes"| node_audio

click node_webapp "https://github.com/qrzaldemir/ecochatbot-ma/blob/main/frontend/src/app/app.component.ts"
click node_adminfeatures "https://github.com/qrzaldemir/ecochatbot-ma/blob/main/frontend/src/app/features/admin/admin.routes.ts"
click node_frontservices "https://github.com/qrzaldemir/ecochatbot-ma/blob/main/frontend/src/app/core/services/atendimento.service.ts"
click node_authfront "https://github.com/qrzaldemir/ecochatbot-ma/blob/main/frontend/src/app/core/services/auth.service.ts"
click node_api "https://github.com/qrzaldemir/ecochatbot-ma/blob/main/backend/app/main.py"
click node_authrouter "https://github.com/qrzaldemir/ecochatbot-ma/blob/main/backend/app/routers/auths_routers.py"
click node_authservice "https://github.com/qrzaldemir/ecochatbot-ma/blob/main/backend/app/services/auth_service.py"
click node_database "https://github.com/qrzaldemir/ecochatbot-ma/blob/main/backend/app/database.py"
click node_webhooks "https://github.com/qrzaldemir/ecochatbot-ma/blob/main/backend/app/routers/webhook_routers.py"
click node_bots "https://github.com/qrzaldemir/ecochatbot-ma/blob/main/backend/app/services/bot_service.py"
click node_flows "https://github.com/qrzaldemir/ecochatbot-ma/tree/main/backend/app/services/bot_handlers"
click node_attendance "https://github.com/qrzaldemir/ecochatbot-ma/blob/main/backend/app/services/atendimento_service.py"
click node_configuration "https://github.com/qrzaldemir/ecochatbot-ma/blob/main/backend/app/services/canal_service.py"
click node_campaigns "https://github.com/qrzaldemir/ecochatbot-ma/blob/main/backend/app/services/campanhas_service.py"
click node_ai "https://github.com/qrzaldemir/ecochatbot-ma/blob/main/backend/app/services/deepseek_service.py"
click node_integrations "https://github.com/qrzaldemir/ecochatbot-ma/blob/main/backend/app/integrations/whatsapp_integration.py"
click node_audio "https://github.com/qrzaldemir/ecochatbot-ma/blob/main/backend/app/services/audio_service.py"

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_webapp,node_adminfeatures,node_frontservices,node_authfront toneBlue
class node_api,node_authrouter,node_authservice,node_database,node_webhooks toneAmber
class node_bots,node_flows,node_attendance,node_configuration,node_campaigns,node_ai toneMint
class node_integrations,node_audio toneRose
class node_customer,node_agent,node_admin,node_messaging toneIndigo
```

## Components

### Web panel

- [Angular panel](https://github.com/qrzaldemir/ecochatbot-ma/blob/main/frontend/src/app/app.component.ts): `frontend/src/app/app.component.ts`
- [Admin and chat](https://github.com/qrzaldemir/ecochatbot-ma/blob/main/frontend/src/app/features/admin/admin.routes.ts): `frontend/src/app/features/admin/admin.routes.ts`
- [Panel API services](https://github.com/qrzaldemir/ecochatbot-ma/blob/main/frontend/src/app/core/services/atendimento.service.ts): `frontend/src/app/core/services/atendimento.service.ts`
- [Session and login](https://github.com/qrzaldemir/ecochatbot-ma/blob/main/frontend/src/app/core/services/auth.service.ts): `frontend/src/app/core/services/auth.service.ts`

### API and security

- [FastAPI application](https://github.com/qrzaldemir/ecochatbot-ma/blob/main/backend/app/main.py): `backend/app/main.py`
- [Authentication routes](https://github.com/qrzaldemir/ecochatbot-ma/blob/main/backend/app/routers/auths_routers.py): `backend/app/routers/auths_routers.py`
- [JWT and password security](https://github.com/qrzaldemir/ecochatbot-ma/blob/main/backend/app/services/auth_service.py): `backend/app/services/auth_service.py`
- [PostgreSQL](https://github.com/qrzaldemir/ecochatbot-ma/blob/main/backend/app/database.py): `backend/app/database.py`
- [Webhook and message routes](https://github.com/qrzaldemir/ecochatbot-ma/blob/main/backend/app/routers/webhook_routers.py): `backend/app/routers/webhook_routers.py`

### Service workflow

- [Bot workflow](https://github.com/qrzaldemir/ecochatbot-ma/blob/main/backend/app/services/bot_service.py): `backend/app/services/bot_service.py`
- [Bot handlers](https://github.com/qrzaldemir/ecochatbot-ma/tree/main/backend/app/services/bot_handlers): `backend/app/services/bot_handlers`
- [Service handling](https://github.com/qrzaldemir/ecochatbot-ma/blob/main/backend/app/services/atendimento_service.py): `backend/app/services/atendimento_service.py`
- [Channels and departments](https://github.com/qrzaldemir/ecochatbot-ma/blob/main/backend/app/services/canal_service.py): `backend/app/services/canal_service.py`
- [Campaigns and reporting](https://github.com/qrzaldemir/ecochatbot-ma/blob/main/backend/app/services/campanhas_service.py): `backend/app/services/campanhas_service.py`
- [AI assistance](https://github.com/qrzaldemir/ecochatbot-ma/blob/main/backend/app/services/deepseek_service.py): `backend/app/services/deepseek_service.py`

### Channels and integrations

- [Channel integrations](https://github.com/qrzaldemir/ecochatbot-ma/blob/main/backend/app/integrations/whatsapp_integration.py): `backend/app/integrations/whatsapp_integration.py`
- [Audio and speech](https://github.com/qrzaldemir/ecochatbot-ma/blob/main/backend/app/services/audio_service.py): `backend/app/services/audio_service.py`

### Other components

- **Customer**
- **Attendant**
- **Administrator**
- **Messaging channel**

## Connections

- Administrator → Angular panel: uses panel
- Attendant → Angular panel: handles conversations
- Angular panel → Admin and chat: renders routes
- Admin and chat → Panel API services: uses services
- Panel API services → FastAPI application: sends API requests
- Angular panel → Session and login: starts login
- Session and login → Authentication routes: posts credentials
- FastAPI application → Authentication routes: registers routes
- Authentication routes → PostgreSQL: queries user
- Authentication routes → JWT and password security: verifies and signs
- Customer → Messaging channel: sends message
- Messaging channel → Webhook and message routes: delivers inbound event
- Webhook and message routes → Bot workflow: dispatches message
- Bot workflow → Bot handlers: routes interaction
- Bot workflow → Service handling: opens service
- Bot workflow → Channels and departments: uses configured channels
- Service handling → Attendant: presents conversation
- Bot workflow → Channel integrations: sends channel replies
- Campaigns and reporting → Channel integrations: broadcasts messages
- Bot workflow → AI assistance: requests assistance
- FastAPI application → Campaigns and reporting: registers domain routes
- FastAPI application → Audio and speech: registers audio routes
