# pouyer/agendagooglecalendarwhatsapp architecture

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

- Interactive diagram: https://gitdiagram.com/pouyer/agendagooglecalendarwhatsapp
- Repository: https://github.com/pouyer/agendagooglecalendarwhatsapp

## Overview

The repository contains three applications: a Google Calendar API, a WhatsApp messaging API, and a scheduled integrator that fetches calendar data, stores it, and sends appointment messages. The graph distinguishes those product stages and shows the WhatsApp API’s application and infrastructure layers. Some internal relationships come from the SOURCE INDEX; unsampled behavior is not expanded beyond those references and the README.

Main entry points: [`EnviaMensaje/main.py`](https://github.com/pouyer/agendagooglecalendarwhatsapp/blob/main/EnviaMensaje/main.py) (Calendar integration), [`api-whatsapp-ts-main/src/infrastructure/ioc.ts`](https://github.com/pouyer/agendagooglecalendarwhatsapp/blob/main/api-whatsapp-ts-main/src/infrastructure/ioc.ts) (Dependency wiring), [`api-whatsapp-ts-main/src/application/lead.create.ts`](https://github.com/pouyer/agendagooglecalendarwhatsapp/blob/main/api-whatsapp-ts-main/src/application/lead.create.ts) (Send and save), [`api-whatsapp-ts-main/src/domain/lead-external.repository.ts`](https://github.com/pouyer/agendagooglecalendarwhatsapp/blob/main/api-whatsapp-ts-main/src/domain/lead-external.repository.ts) (Sender contract)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_calendar["Calendar API"]
  node_calendar_app["Calendar API<br/>[main.py]"]
  node_calendar_routes["Calendar routes<br/>[calendar.py]"]
  node_calendar_ops["Calendar operations<br/>[calendar.py]"]
  node_calendar_auth["Google auth<br/>[get_service.py]"]
  node_calendar_responses["Response formatting<br/>[response_json.py]"]
end

subgraph group_integrator["Scheduled integrator"]
  node_scheduler["Schedule checks<br/>[demonio.py]"]
  node_integrator_main["Calendar integration<br/>[main.py]"]
  node_db_connection["DB connection<br/>[Db.py]"]
  node_message_sender["WhatsApp sender<br/>[EnvioMensaje.py]"]
  node_integrator_log["Logging<br/>[log.py]"]
end

subgraph group_whatsapp["WhatsApp API"]
  node_whatsapp_app["WhatsApp API<br/>[app.ts]"]
end

subgraph group_whatsapp_internals["Messaging internals"]
  node_router_index["Route setup<br/>[index.ts]"]
  node_lead_route["Lead route<br/>[lead.route.ts]"]
  node_lead_controller["Lead controller<br/>[lead.ctrl.ts]"]
  node_ioc["Dependency wiring<br/>[ioc.ts]"]
  node_lead_create["Send and save<br/>[lead.create.ts]"]
  node_lead_domain["Lead model<br/>[lead.ts]"]
  node_lead_repository["Lead repository contract<br/>[lead.repository.ts]"]
  node_external_contract["Sender contract"]
  node_mock_repository["Mock repository<br/>[mock.repository.ts]"]
  node_ws_sender["WS sender<br/>[ws.external.ts]"]
  node_meta_sender["Meta sender<br/>[meta.repository.ts]"]
  node_twilio_sender["Twilio sender"]
end

node_calendar_users(("Calendar clients"))
node_google_calendar["Google Calendar"]
node_agenda_db[("Agenda database")]
node_whatsapp_clients(("API clients"))

node_calendar_users -->|"requests"| node_calendar_app
node_calendar_app -->|"mounts routes"| node_calendar_routes
node_calendar_routes -->|"dispatches"| node_calendar_ops
node_calendar_ops -->|"gets service"| node_calendar_auth
node_calendar_auth -->|"builds service"| node_google_calendar
node_calendar_ops -->|"formats responses"| node_calendar_responses
node_integrator_main -->|"checks schedule"| node_scheduler
node_integrator_main -->|"fetches calendar"| node_calendar_app
node_integrator_main -->|"uses connection"| node_db_connection
node_integrator_main -->|"inserts agenda"| node_agenda_db
node_db_connection -->|"connects"| node_agenda_db
node_integrator_main -->|"sends messages"| node_message_sender
node_integrator_main -->|"calls messaging API"| node_whatsapp_app
node_integrator_main -->|"logs activity"| node_integrator_log
node_whatsapp_clients -->|"requests"| node_whatsapp_app
node_whatsapp_app -->|"loads routes"| node_router_index
node_lead_route -->|"dispatches"| node_lead_controller
node_lead_route -->|"gets dependencies"| node_ioc
node_lead_controller -->|"invokes"| node_lead_create
node_ioc -->|"wires"| node_lead_controller
node_ioc -->|"constructs"| node_lead_create
node_ioc -->|"registers"| node_mock_repository
node_ioc -->|"registers"| node_ws_sender
node_lead_create -->|"saves lead"| node_lead_repository
node_lead_create -->|"sends message"| node_external_contract
node_lead_repository -->|"returns lead"| node_lead_domain
node_mock_repository -->|"implements"| node_lead_repository
node_ws_sender -->|"implements"| node_external_contract
node_meta_sender -->|"implements"| node_external_contract
node_twilio_sender -->|"implements"| node_external_contract

click node_calendar_app "https://github.com/pouyer/agendagooglecalendarwhatsapp/blob/main/api-google-calendar/main.py"
click node_calendar_routes "https://github.com/pouyer/agendagooglecalendarwhatsapp/blob/main/api-google-calendar/routes/calendar.py"
click node_calendar_ops "https://github.com/pouyer/agendagooglecalendarwhatsapp/blob/main/api-google-calendar/functions/calendar.py"
click node_calendar_auth "https://github.com/pouyer/agendagooglecalendarwhatsapp/blob/main/api-google-calendar/functions/get_service.py"
click node_calendar_responses "https://github.com/pouyer/agendagooglecalendarwhatsapp/blob/main/api-google-calendar/responses/response_json.py"
click node_scheduler "https://github.com/pouyer/agendagooglecalendarwhatsapp/blob/main/EnviaMensaje/demonio.py"
click node_integrator_main "https://github.com/pouyer/agendagooglecalendarwhatsapp/blob/main/EnviaMensaje/main.py"
click node_db_connection "https://github.com/pouyer/agendagooglecalendarwhatsapp/blob/main/EnviaMensaje/Db.py"
click node_message_sender "https://github.com/pouyer/agendagooglecalendarwhatsapp/blob/main/EnviaMensaje/EnvioMensaje.py"
click node_integrator_log "https://github.com/pouyer/agendagooglecalendarwhatsapp/blob/main/EnviaMensaje/log.py"
click node_whatsapp_app "https://github.com/pouyer/agendagooglecalendarwhatsapp/blob/main/api-whatsapp-ts-main/src/app.ts"
click node_router_index "https://github.com/pouyer/agendagooglecalendarwhatsapp/blob/main/api-whatsapp-ts-main/src/infrastructure/router/index.ts"
click node_lead_route "https://github.com/pouyer/agendagooglecalendarwhatsapp/blob/main/api-whatsapp-ts-main/src/infrastructure/router/lead.route.ts"
click node_lead_controller "https://github.com/pouyer/agendagooglecalendarwhatsapp/blob/main/api-whatsapp-ts-main/src/infrastructure/controller/lead.ctrl.ts"
click node_ioc "https://github.com/pouyer/agendagooglecalendarwhatsapp/blob/main/api-whatsapp-ts-main/src/infrastructure/ioc.ts"
click node_lead_create "https://github.com/pouyer/agendagooglecalendarwhatsapp/blob/main/api-whatsapp-ts-main/src/application/lead.create.ts"
click node_lead_domain "https://github.com/pouyer/agendagooglecalendarwhatsapp/blob/main/api-whatsapp-ts-main/src/domain/lead.ts"
click node_lead_repository "https://github.com/pouyer/agendagooglecalendarwhatsapp/blob/main/api-whatsapp-ts-main/src/domain/lead.repository.ts"
click node_external_contract "https://github.com/pouyer/agendagooglecalendarwhatsapp/blob/main/api-whatsapp-ts-main/src/domain/lead-external.repository.ts"
click node_mock_repository "https://github.com/pouyer/agendagooglecalendarwhatsapp/blob/main/api-whatsapp-ts-main/src/infrastructure/repositories/mock.repository.ts"
click node_ws_sender "https://github.com/pouyer/agendagooglecalendarwhatsapp/blob/main/api-whatsapp-ts-main/src/infrastructure/repositories/ws.external.ts"
click node_meta_sender "https://github.com/pouyer/agendagooglecalendarwhatsapp/blob/main/api-whatsapp-ts-main/src/infrastructure/repositories/meta.repository.ts"
click node_twilio_sender "https://github.com/pouyer/agendagooglecalendarwhatsapp/blob/main/api-whatsapp-ts-main/src/infrastructure/repositories/twilio.repository.ts"

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_calendar_app,node_calendar_routes,node_calendar_ops,node_calendar_auth,node_calendar_responses,node_calendar_users,node_whatsapp_clients toneBlue
class node_scheduler,node_integrator_main,node_db_connection,node_message_sender,node_integrator_log,node_agenda_db toneAmber
class node_whatsapp_app toneMint
class node_router_index,node_lead_route,node_lead_controller,node_ioc,node_lead_create,node_lead_domain,node_lead_repository,node_external_contract,node_mock_repository,node_ws_sender,node_meta_sender,node_twilio_sender toneRose
class node_google_calendar toneIndigo
```

## Components

### Calendar API

- [Calendar API](https://github.com/pouyer/agendagooglecalendarwhatsapp/blob/main/api-google-calendar/main.py): `api-google-calendar/main.py`
- [Calendar routes](https://github.com/pouyer/agendagooglecalendarwhatsapp/blob/main/api-google-calendar/routes/calendar.py): `api-google-calendar/routes/calendar.py`
- [Calendar operations](https://github.com/pouyer/agendagooglecalendarwhatsapp/blob/main/api-google-calendar/functions/calendar.py): `api-google-calendar/functions/calendar.py`
- [Google auth](https://github.com/pouyer/agendagooglecalendarwhatsapp/blob/main/api-google-calendar/functions/get_service.py): `api-google-calendar/functions/get_service.py`
- [Response formatting](https://github.com/pouyer/agendagooglecalendarwhatsapp/blob/main/api-google-calendar/responses/response_json.py): `api-google-calendar/responses/response_json.py`

### Scheduled integrator

- [Schedule checks](https://github.com/pouyer/agendagooglecalendarwhatsapp/blob/main/EnviaMensaje/demonio.py): `EnviaMensaje/demonio.py`
- [Calendar integration](https://github.com/pouyer/agendagooglecalendarwhatsapp/blob/main/EnviaMensaje/main.py): `EnviaMensaje/main.py`
- [DB connection](https://github.com/pouyer/agendagooglecalendarwhatsapp/blob/main/EnviaMensaje/Db.py): `EnviaMensaje/Db.py`
- [WhatsApp sender](https://github.com/pouyer/agendagooglecalendarwhatsapp/blob/main/EnviaMensaje/EnvioMensaje.py): `EnviaMensaje/EnvioMensaje.py`
- [Logging](https://github.com/pouyer/agendagooglecalendarwhatsapp/blob/main/EnviaMensaje/log.py): `EnviaMensaje/log.py`

### WhatsApp API

- [WhatsApp API](https://github.com/pouyer/agendagooglecalendarwhatsapp/blob/main/api-whatsapp-ts-main/src/app.ts): `api-whatsapp-ts-main/src/app.ts`

### Messaging internals

- [Route setup](https://github.com/pouyer/agendagooglecalendarwhatsapp/blob/main/api-whatsapp-ts-main/src/infrastructure/router/index.ts): `api-whatsapp-ts-main/src/infrastructure/router/index.ts`
- [Lead route](https://github.com/pouyer/agendagooglecalendarwhatsapp/blob/main/api-whatsapp-ts-main/src/infrastructure/router/lead.route.ts): `api-whatsapp-ts-main/src/infrastructure/router/lead.route.ts`
- [Lead controller](https://github.com/pouyer/agendagooglecalendarwhatsapp/blob/main/api-whatsapp-ts-main/src/infrastructure/controller/lead.ctrl.ts): `api-whatsapp-ts-main/src/infrastructure/controller/lead.ctrl.ts`
- [Dependency wiring](https://github.com/pouyer/agendagooglecalendarwhatsapp/blob/main/api-whatsapp-ts-main/src/infrastructure/ioc.ts): `api-whatsapp-ts-main/src/infrastructure/ioc.ts`
- [Send and save](https://github.com/pouyer/agendagooglecalendarwhatsapp/blob/main/api-whatsapp-ts-main/src/application/lead.create.ts): `api-whatsapp-ts-main/src/application/lead.create.ts`
- [Lead model](https://github.com/pouyer/agendagooglecalendarwhatsapp/blob/main/api-whatsapp-ts-main/src/domain/lead.ts): `api-whatsapp-ts-main/src/domain/lead.ts`
- [Lead repository contract](https://github.com/pouyer/agendagooglecalendarwhatsapp/blob/main/api-whatsapp-ts-main/src/domain/lead.repository.ts): `api-whatsapp-ts-main/src/domain/lead.repository.ts`
- [Sender contract](https://github.com/pouyer/agendagooglecalendarwhatsapp/blob/main/api-whatsapp-ts-main/src/domain/lead-external.repository.ts): `api-whatsapp-ts-main/src/domain/lead-external.repository.ts`
- [Mock repository](https://github.com/pouyer/agendagooglecalendarwhatsapp/blob/main/api-whatsapp-ts-main/src/infrastructure/repositories/mock.repository.ts): `api-whatsapp-ts-main/src/infrastructure/repositories/mock.repository.ts`
- [WS sender](https://github.com/pouyer/agendagooglecalendarwhatsapp/blob/main/api-whatsapp-ts-main/src/infrastructure/repositories/ws.external.ts): `api-whatsapp-ts-main/src/infrastructure/repositories/ws.external.ts`
- [Meta sender](https://github.com/pouyer/agendagooglecalendarwhatsapp/blob/main/api-whatsapp-ts-main/src/infrastructure/repositories/meta.repository.ts): `api-whatsapp-ts-main/src/infrastructure/repositories/meta.repository.ts`
- [Twilio sender](https://github.com/pouyer/agendagooglecalendarwhatsapp/blob/main/api-whatsapp-ts-main/src/infrastructure/repositories/twilio.repository.ts): `api-whatsapp-ts-main/src/infrastructure/repositories/twilio.repository.ts`

### Other components

- **Calendar clients**
- **Google Calendar**
- **Agenda database**
- **API clients**

## Connections

- Calendar clients → Calendar API: requests (evidence: `api-google-calendar/main.py`)
- Calendar API → Calendar routes: mounts routes (evidence: `api-google-calendar/main.py`)
- Calendar routes → Calendar operations: dispatches (evidence: `api-google-calendar/routes/calendar.py`)
- Calendar operations → Google auth: gets service (evidence: `api-google-calendar/functions/calendar.py`)
- Google auth → Google Calendar: builds service (evidence: `api-google-calendar/functions/get_service.py`)
- Calendar operations → Response formatting: formats responses (evidence: `api-google-calendar/functions/calendar.py`)
- Calendar integration → Schedule checks: checks schedule (evidence: `EnviaMensaje/main.py`)
- Calendar integration → Calendar API: fetches calendar (evidence: `README.md`)
- Calendar integration → DB connection: uses connection (evidence: `EnviaMensaje/main.py`)
- Calendar integration → Agenda database: inserts agenda (evidence: `EnviaMensaje/main.py`)
- DB connection → Agenda database: connects
- Calendar integration → WhatsApp sender: sends messages (evidence: `EnviaMensaje/main.py`)
- Calendar integration → WhatsApp API: calls messaging API (evidence: `README.md`)
- Calendar integration → Logging: logs activity (evidence: `EnviaMensaje/main.py`)
- API clients → WhatsApp API: requests (evidence: `api-whatsapp-ts-main/src/app.ts`)
- WhatsApp API → Route setup: loads routes (evidence: `api-whatsapp-ts-main/src/app.ts`)
- Lead route → Lead controller: dispatches (evidence: `api-whatsapp-ts-main/src/infrastructure/router/lead.route.ts`)
- Lead route → Dependency wiring: gets dependencies (evidence: `api-whatsapp-ts-main/src/infrastructure/router/lead.route.ts`)
- Lead controller → Send and save: invokes (evidence: `api-whatsapp-ts-main/src/infrastructure/controller/lead.ctrl.ts`)
- Dependency wiring → Lead controller: wires (evidence: `api-whatsapp-ts-main/src/infrastructure/ioc.ts`)
- Dependency wiring → Send and save: constructs (evidence: `api-whatsapp-ts-main/src/infrastructure/ioc.ts`)
- Dependency wiring → Mock repository: registers (evidence: `api-whatsapp-ts-main/src/infrastructure/ioc.ts`)
- Dependency wiring → WS sender: registers (evidence: `api-whatsapp-ts-main/src/infrastructure/ioc.ts`)
- Send and save → Lead repository contract: saves lead (evidence: `api-whatsapp-ts-main/src/application/lead.create.ts`)
- Send and save → Sender contract: sends message (evidence: `api-whatsapp-ts-main/src/application/lead.create.ts`)
- Lead repository contract → Lead model: returns lead (evidence: `api-whatsapp-ts-main/src/domain/lead.repository.ts`)
- Mock repository → Lead repository contract: implements (evidence: `api-whatsapp-ts-main/src/infrastructure/repositories/mock.repository.ts`)
- WS sender → Sender contract: implements (evidence: `api-whatsapp-ts-main/src/infrastructure/repositories/ws.external.ts`)
- Meta sender → Sender contract: implements (evidence: `api-whatsapp-ts-main/src/infrastructure/repositories/meta.repository.ts`)
- Twilio sender → Sender contract: implements (evidence: `api-whatsapp-ts-main/src/infrastructure/repositories/twilio.repository.ts`)
