# ftw-soft/citabot-node-playwright architecture

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

- Interactive diagram: https://gitdiagram.com/ftw-soft/citabot-node-playwright
- Repository: https://github.com/ftw-soft/citabot-node-playwright

## Overview

CitaBot automates a Spanish administrative appointment flow: it opens a browser, walks the configured form steps, selects an eligible appointment, and handles retries and detections. Human-like cursor, keyboard, and action timing support the interaction; recorder, statistics, notification, and configuration capabilities support operations. The README documents fingerprint protection and actor rotation. Some modules are indexed but not excerpted, so their internal relationships are omitted unless documented or directly evidenced.

Main entry points: [`src/steps/walker.ts`](https://github.com/ftw-soft/citabot-node-playwright/blob/main/src/steps/walker.ts) (Step walker), [`src/bot/runner.ts`](https://github.com/ftw-soft/citabot-node-playwright/blob/main/src/bot/runner.ts) (Run coordinator), [`src/bot/pipeline.ts`](https://github.com/ftw-soft/citabot-node-playwright/blob/main/src/bot/pipeline.ts) (Action pipeline), [`src/index.ts`](https://github.com/ftw-soft/citabot-node-playwright/blob/main/src/index.ts) (Bot entry)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_booking["Booking flow"]
  node_entry["Bot entry<br/>[index.ts]"]
  node_runner["Run coordinator<br/>[runner.ts]"]
  node_walker["Step walker<br/>[walker.ts]"]
  node_region["Select region<br/>[00-selectRegion.ts]"]
  node_tramite["Choose procedure<br/>[01-tramite.ts]"]
  node_enter["Enter flow<br/>[02-entrar.ts]"]
  node_identity["Enter identity<br/>[03-personalId.ts]"]
  node_identityconfirm["Confirm identity"]
  node_office["Choose office<br/>[05-office.ts]"]
  node_contact["Enter contact"]
  node_appointment["Select appointment<br/>[07-citaSelect.ts]"]
end

subgraph group_interaction["Browser interaction"]
  node_browser["Browser session<br/>[browser.ts]"]
  node_pipeline["Action pipeline<br/>[pipeline.ts]"]
  node_cursor["Human cursor<br/>[cursor.ts]"]
  node_keyboard["Human keyboard<br/>[keyboard.ts]"]
  node_actions["Step actions<br/>[actions.ts]"]
end

subgraph group_operations["Run operations"]
  node_network["Network recorder"]
  node_actionrec["Action recorder<br/>[action-recorder.ts]"]
  node_stats[("Run statistics<br/>[stats.ts]")]
  node_notifications["Notifications<br/>[notifications.ts]"]
end

subgraph group_support["Configuration and integrations"]
  node_config["App configuration<br/>[config.ts]"]
  node_officeutil["Office matching<br/>[office.ts]"]
  node_parsers["Appointment parsing<br/>[parsers.ts]"]
  node_mock["Mock cita server<br/>[index.ts]"]
end

node_user(("Operator"))
node_cita_site["Cita website"]
node_homeassistant["Home Assistant"]

node_user -->|"starts run"| node_entry
node_entry -->|"starts"| node_runner
node_entry -->|"loads"| node_config
node_runner -->|"creates"| node_browser
node_runner -->|"attaches"| node_network
node_runner -->|"installs"| node_actionrec
node_runner -->|"records"| node_stats
node_runner -->|"notifies"| node_notifications
node_runner -->|"rotates actors"| node_config
node_walker -->|"runs actions"| node_pipeline
node_walker -->|"uses"| node_cursor
node_walker -->|"uses"| node_keyboard
node_actions -->|"defines actions"| node_pipeline
node_pipeline -->|"moves cursor"| node_cursor
node_pipeline -.->|"performs browser actions"| node_cita_site
node_walker -->|"executes in order"| node_region
node_walker -->|"executes in order"| node_tramite
node_walker -->|"executes in order"| node_enter
node_walker -->|"executes in order"| node_identity
node_walker -->|"executes in order"| node_identityconfirm
node_walker -->|"executes in order"| node_office
node_walker -->|"executes in order"| node_contact
node_walker -->|"executes in order"| node_appointment
node_office -->|"matches office"| node_officeutil
node_appointment -->|"parses candidates"| node_parsers
node_appointment -->|"requests recovery notice"| node_notifications
node_runner -.->|"automates booking"| node_cita_site
node_mock -.->|"simulates"| node_cita_site
node_notifications -.->|"sends alerts"| node_homeassistant

click node_entry "https://github.com/ftw-soft/citabot-node-playwright/blob/main/src/index.ts"
click node_runner "https://github.com/ftw-soft/citabot-node-playwright/blob/main/src/bot/runner.ts"
click node_walker "https://github.com/ftw-soft/citabot-node-playwright/blob/main/src/steps/walker.ts"
click node_region "https://github.com/ftw-soft/citabot-node-playwright/blob/main/src/steps/00-selectRegion.ts"
click node_tramite "https://github.com/ftw-soft/citabot-node-playwright/blob/main/src/steps/01-tramite.ts"
click node_enter "https://github.com/ftw-soft/citabot-node-playwright/blob/main/src/steps/02-entrar.ts"
click node_identity "https://github.com/ftw-soft/citabot-node-playwright/blob/main/src/steps/03-personalId.ts"
click node_identityconfirm "https://github.com/ftw-soft/citabot-node-playwright/blob/main/src/steps/04-personalIdConfirm.ts"
click node_office "https://github.com/ftw-soft/citabot-node-playwright/blob/main/src/steps/05-office.ts"
click node_contact "https://github.com/ftw-soft/citabot-node-playwright/blob/main/src/steps/06-personalContact.ts"
click node_appointment "https://github.com/ftw-soft/citabot-node-playwright/blob/main/src/steps/07-citaSelect.ts"
click node_browser "https://github.com/ftw-soft/citabot-node-playwright/blob/main/src/bot/browser.ts"
click node_pipeline "https://github.com/ftw-soft/citabot-node-playwright/blob/main/src/bot/pipeline.ts"
click node_cursor "https://github.com/ftw-soft/citabot-node-playwright/blob/main/src/bot/cursor.ts"
click node_keyboard "https://github.com/ftw-soft/citabot-node-playwright/blob/main/src/bot/keyboard.ts"
click node_actions "https://github.com/ftw-soft/citabot-node-playwright/blob/main/src/steps/actions.ts"
click node_network "https://github.com/ftw-soft/citabot-node-playwright/blob/main/src/bot/network-recorder.ts"
click node_actionrec "https://github.com/ftw-soft/citabot-node-playwright/blob/main/src/bot/action-recorder.ts"
click node_stats "https://github.com/ftw-soft/citabot-node-playwright/blob/main/src/stats.ts"
click node_notifications "https://github.com/ftw-soft/citabot-node-playwright/blob/main/src/notifications.ts"
click node_config "https://github.com/ftw-soft/citabot-node-playwright/blob/main/src/config.ts"
click node_officeutil "https://github.com/ftw-soft/citabot-node-playwright/blob/main/src/lib/office.ts"
click node_parsers "https://github.com/ftw-soft/citabot-node-playwright/blob/main/src/lib/parsers.ts"
click node_mock "https://github.com/ftw-soft/citabot-node-playwright/blob/main/src/mock-server/index.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_entry,node_runner,node_walker,node_region,node_tramite,node_enter,node_identity,node_identityconfirm,node_office,node_contact,node_appointment toneBlue
class node_browser,node_pipeline,node_cursor,node_keyboard,node_actions toneAmber
class node_network,node_actionrec,node_stats,node_notifications toneMint
class node_config,node_officeutil,node_parsers,node_mock toneRose
class node_user,node_cita_site,node_homeassistant toneIndigo
```

## Components

### Booking flow

- [Bot entry](https://github.com/ftw-soft/citabot-node-playwright/blob/main/src/index.ts): `src/index.ts`
- [Run coordinator](https://github.com/ftw-soft/citabot-node-playwright/blob/main/src/bot/runner.ts): `src/bot/runner.ts`
- [Step walker](https://github.com/ftw-soft/citabot-node-playwright/blob/main/src/steps/walker.ts): `src/steps/walker.ts`
- [Select region](https://github.com/ftw-soft/citabot-node-playwright/blob/main/src/steps/00-selectRegion.ts): `src/steps/00-selectRegion.ts`
- [Choose procedure](https://github.com/ftw-soft/citabot-node-playwright/blob/main/src/steps/01-tramite.ts): `src/steps/01-tramite.ts`
- [Enter flow](https://github.com/ftw-soft/citabot-node-playwright/blob/main/src/steps/02-entrar.ts): `src/steps/02-entrar.ts`
- [Enter identity](https://github.com/ftw-soft/citabot-node-playwright/blob/main/src/steps/03-personalId.ts): `src/steps/03-personalId.ts`
- [Confirm identity](https://github.com/ftw-soft/citabot-node-playwright/blob/main/src/steps/04-personalIdConfirm.ts): `src/steps/04-personalIdConfirm.ts`
- [Choose office](https://github.com/ftw-soft/citabot-node-playwright/blob/main/src/steps/05-office.ts): `src/steps/05-office.ts`
- [Enter contact](https://github.com/ftw-soft/citabot-node-playwright/blob/main/src/steps/06-personalContact.ts): `src/steps/06-personalContact.ts`
- [Select appointment](https://github.com/ftw-soft/citabot-node-playwright/blob/main/src/steps/07-citaSelect.ts): `src/steps/07-citaSelect.ts`

### Browser interaction

- [Browser session](https://github.com/ftw-soft/citabot-node-playwright/blob/main/src/bot/browser.ts): `src/bot/browser.ts`
- [Action pipeline](https://github.com/ftw-soft/citabot-node-playwright/blob/main/src/bot/pipeline.ts): `src/bot/pipeline.ts`
- [Human cursor](https://github.com/ftw-soft/citabot-node-playwright/blob/main/src/bot/cursor.ts): `src/bot/cursor.ts`
- [Human keyboard](https://github.com/ftw-soft/citabot-node-playwright/blob/main/src/bot/keyboard.ts): `src/bot/keyboard.ts`
- [Step actions](https://github.com/ftw-soft/citabot-node-playwright/blob/main/src/steps/actions.ts): `src/steps/actions.ts`

### Run operations

- [Network recorder](https://github.com/ftw-soft/citabot-node-playwright/blob/main/src/bot/network-recorder.ts): `src/bot/network-recorder.ts`
- [Action recorder](https://github.com/ftw-soft/citabot-node-playwright/blob/main/src/bot/action-recorder.ts): `src/bot/action-recorder.ts`
- [Run statistics](https://github.com/ftw-soft/citabot-node-playwright/blob/main/src/stats.ts): `src/stats.ts`
- [Notifications](https://github.com/ftw-soft/citabot-node-playwright/blob/main/src/notifications.ts): `src/notifications.ts`

### Configuration and integrations

- [App configuration](https://github.com/ftw-soft/citabot-node-playwright/blob/main/src/config.ts): `src/config.ts`
- [Office matching](https://github.com/ftw-soft/citabot-node-playwright/blob/main/src/lib/office.ts): `src/lib/office.ts`
- [Appointment parsing](https://github.com/ftw-soft/citabot-node-playwright/blob/main/src/lib/parsers.ts): `src/lib/parsers.ts`
- [Mock cita server](https://github.com/ftw-soft/citabot-node-playwright/blob/main/src/mock-server/index.ts): `src/mock-server/index.ts`

### Other components

- **Operator**
- **Cita website**
- **Home Assistant**

## Connections

- Operator → Bot entry: starts run (evidence: `README.md`)
- Bot entry → Run coordinator: starts (evidence: `src/index.ts`)
- Bot entry → App configuration: loads (evidence: `src/index.ts`)
- Run coordinator → Browser session: creates (evidence: `src/bot/runner.ts`)
- Run coordinator → Network recorder: attaches (evidence: `src/bot/runner.ts`)
- Run coordinator → Action recorder: installs (evidence: `src/bot/runner.ts`)
- Run coordinator → Run statistics: records (evidence: `src/bot/runner.ts`)
- Run coordinator → Notifications: notifies (evidence: `src/bot/runner.ts`)
- Run coordinator → App configuration: rotates actors (evidence: `src/bot/runner.ts`)
- Step walker → Action pipeline: runs actions (evidence: `src/steps/walker.ts`)
- Step walker → Human cursor: uses (evidence: `src/steps/walker.ts`)
- Step walker → Human keyboard: uses (evidence: `src/steps/walker.ts`)
- Step actions → Action pipeline: defines actions (evidence: `src/steps/actions.ts`)
- Action pipeline → Human cursor: moves cursor (evidence: `src/bot/pipeline.ts`)
- Action pipeline → Cita website: performs browser actions
- Step walker → Select region: executes in order (evidence: `README.md`)
- Step walker → Choose procedure: executes in order (evidence: `README.md`)
- Step walker → Enter flow: executes in order (evidence: `README.md`)
- Step walker → Enter identity: executes in order (evidence: `README.md`)
- Step walker → Confirm identity: executes in order (evidence: `README.md`)
- Step walker → Choose office: executes in order (evidence: `README.md`)
- Step walker → Enter contact: executes in order (evidence: `README.md`)
- Step walker → Select appointment: executes in order (evidence: `README.md`)
- Choose office → Office matching: matches office (evidence: `src/steps/05-office.ts`)
- Select appointment → Appointment parsing: parses candidates (evidence: `src/steps/07-citaSelect.ts`)
- Select appointment → Notifications: requests recovery notice (evidence: `src/steps/07-citaSelect.ts`)
- Run coordinator → Cita website: automates booking
- Mock cita server → Cita website: simulates
- Notifications → Home Assistant: sends alerts
