# hu9o73/phishing-awareness-chatbot architecture

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

- Interactive diagram: https://gitdiagram.com/hu9o73/phishing-awareness-chatbot
- Repository: https://github.com/hu9o73/phishing-awareness-chatbot

## Overview

1. **System shape**
   - This repo is a split-stack phishing-awareness platform: a Vue 3 frontend plus a set of Python FastAPI microservices.
   - The backend is organized as separate deployable services rather than one monolith, each with its own Dockerfile, API routes, service layer, and database interactors.

2. **Frontend boundary**
   - `Application/pac-front` is a single-page app built with Vue 3, Vite, and Tailwind.
   - It is centered around a dashboard experience with role-based views: admin, org admin, and member.
   - Frontend structure is conventional: `views` for page shells, `components` for reusable UI, `router` for navigation, and `stores/user.js` for client-side user/session state.
   - In production, the built frontend is served by nginx and proxies API calls to the backend.

3. **Backend service topology**
   - `Application/pac-back/src` contains five backend services:
     - **authentication** on port 8001
     - **challenges** on port 8002
     - **monitoring** on port 8003
     - **agentic** on port 8004
     - **clocking** on port 8005
   - Each service has its own `app`, `api/routes/v1`, `services`, `database`, and `models` directories, which indicates clear bounded contexts with local business logic and data access.

4. **Authentication service as the identity boundary**
   - `authentication` is the central identity and organization-management service.
   - Its routes are split by role: `Admin`, `OrgAdmin`, and general authentication endpoints.
   - It exposes user, organization, and membership operations that other services likely depend on for authorization context.
   - `Middleware.py` and `services/Base/authentication.py` suggest shared request authentication/authorization enforcement.

5. **Challenges service as the user workflow boundary**
   - `challenges` is the user-facing campaign execution service.
   - Its routes cover organization-member access and scenario execution.
   - This service depends on auth and a base agentic integration, suggesting it orchestrates challenge flows for end users rather than storing everything itself.
   - It has dedicated interactors for user emails and scenarios, which indicates domain-focused data access.

6. **Monitoring service as the reporting/telemetry boundary**
   - `monitoring` collects and exposes campaign progress, exchanges, challenges, and scenarios.
   - It also includes an `email_service`, which implies it can trigger or inspect email-related events as part of monitoring flows.
   - This service is the reporting layer for organizational visibility into phishing-awareness activities.

7. **Agentic service as the AI orchestration boundary**
   - `agentic` is the AI-assisted backend: it includes `agentic_flow`, `messages`, and `hook_email` routes.
   - The presence of agent classes (`basic_agent`, `email_agentic_flow`, `hook_emailer_agent`) shows this service encapsulates agent behavior, email-driven automation, and flow coordination.
   - Given the README, this is where integrations such as OpenAI, Langfuse, and Resend are most likely used.

8. **Clocking service as a small specialized service**
   - `clocking` is a separate backend service with minimal tree depth, which suggests a narrow responsibility, likely time-based or scheduled behavior.
   - It appears intentionally isolated from the main domain services.

9. **Data layer pattern**
   - Each major backend service owns a `database/client.py` plus `database/interactors/...`.
   - The interactor structure is domain-oriented rather than ORM-centric: operations are grouped by business area such as users, organizations, scenarios, emails, challenges, exchanges, and memberships.
   - This makes the service boundaries real at the persistence layer, not just at the API layer.

10. **Shared model and cross-cutting conventions**
   - All services include `models/base_models.py` and `models/enum_models.py`, implying shared serialization and domain enums within each service.
   - `services/Base/authentication.py` appears across services, indicating a common pattern for request identity checks.
   - `middleware` exists in some services, showing cross-cutting request processing is handled per service rather than by a central gateway.

11. **Request flow across the system**
   - Typical flow is: frontend UI action → service API route → service layer → domain interactor → Supabase/Postgres.
   - For workflows that involve AI or email, the request then fans out from the main domain service to the `agentic` service and external providers.
   - For admin and organizational operations, the frontend talks primarily to `authentication`, while challenge execution and reporting use `challenges` and `monitoring`.

12. **Infrastructure and deployment**
   - The repo is container-first: each service has a Dockerfile, and the root `docker-compose-full-build.yaml` assembles the full stack.
   - The README states the full deployment uses nginx to expose all APIs under `http://localhost:8080/api/*` while proxying to the internal service ports.
   - Local development can run backend services independently, or the frontend can run as a separate Vite dev server.

13. **External systems that materially affect architecture**
   - **Supabase/Postgres** is the persistence backend for all services.
   - **OpenAI**, **Langfuse**, and **Resend** are explicit backend dependencies for AI, tracing/observability of model usage, and email delivery.
   - These integrations are most relevant to the agentic and email-related flows, and they shape the platform’s asynchronous/user-interaction behavior.

14. **Testing and quality boundaries**
   - Backend unit tests live under `tests/unit_tests`, with a separate Docker-based test compose file.
   - The test tree mirrors the service boundaries, which reinforces that the architecture is organized by domain service and not by shared library.

Main entry points: [`Application/pac-front`](https://github.com/hu9o73/phishing-awareness-chatbot/tree/main/Application/pac-front) (PAC Front), [`Application/pac-back/src/authentication`](https://github.com/hu9o73/phishing-awareness-chatbot/tree/main/Application/pac-back/src/authentication) (Authentication), [`Application/docker-compose-full-build.yaml`](https://github.com/hu9o73/phishing-awareness-chatbot/blob/main/Application/docker-compose-full-build.yaml) (Compose Build), [`Application/pac-back/src/monitoring`](https://github.com/hu9o73/phishing-awareness-chatbot/tree/main/Application/pac-back/src/monitoring) (Monitoring)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_frontend["Frontend"]
  node_front_app["PAC Front<br/>vue spa"]
  node_front_router["Router<br/>navigation<br/>[index.js]"]
  node_front_store["User Store<br/>session state<br/>[user.js]"]
  node_front_dash["Dashboards<br/>ui shell"]
  node_front_modals["Workflow Modals<br/>ui flows"]
  node_front_views["Views<br/>page shells"]
end

subgraph group_backend["Backend"]
  node_auth_svc["Authentication<br/>identity service"]
  node_auth_routes["Auth Routes<br/>api layer"]
  node_auth_logic["Auth Logic<br/>service layer"]
  node_challenge_svc["Challenges<br/>workflow service"]
  node_challenge_routes["Challenge Routes<br/>api layer"]
  node_challenge_logic["Challenge Logic<br/>service layer"]
  node_monitor_svc["Monitoring<br/>reporting service"]
  node_monitor_routes["Monitoring Routes<br/>api layer"]
  node_monitor_logic["Monitoring Logic<br/>service layer"]
  node_agentic_svc["Agentic<br/>ai orchestration"]
  node_agentic_routes["Agentic Routes<br/>api layer"]
  node_agentic_logic["Agentic Logic<br/>service layer"]
  node_clock_svc["Clocking<br/>specialized service"]
end

subgraph group_infra["Infra"]
  node_compose["Compose Build<br/>deployment"]
  node_frontend_nginx["Nginx<br/>edge proxy<br/>[nginx.conf]"]
  node_backend_tests["Unit Tests<br/>test suite"]
end

node_front_app -->|"navigates"| node_front_router
node_front_app -->|"session state"| node_front_store
node_front_app -->|"renders"| node_front_views
node_front_views -->|"uses"| node_front_dash
node_front_dash -->|"opens"| node_front_modals
node_front_app -->|"api calls"| node_auth_svc
node_front_app -->|"api calls"| node_challenge_svc
node_front_app -->|"api calls"| node_monitor_svc
node_auth_svc -->|"exposes"| node_auth_routes
node_auth_routes -->|"delegates"| node_auth_logic
node_auth_logic -->|"uses data"| node_auth_svc
node_challenge_svc -->|"exposes"| node_challenge_routes
node_challenge_routes -->|"delegates"| node_challenge_logic
node_challenge_logic -.->|"auth dependency"| node_auth_svc
node_challenge_logic -.->|"orchestrates"| node_agentic_svc
node_monitor_svc -->|"exposes"| node_monitor_routes
node_monitor_routes -->|"delegates"| node_monitor_logic
node_monitor_logic -.->|"auth dependency"| node_auth_svc
node_agentic_svc -->|"exposes"| node_agentic_routes
node_agentic_routes -->|"delegates"| node_agentic_logic
node_agentic_logic -.->|"signals"| node_monitor_svc
node_compose -->|"deploys"| node_auth_svc
node_compose -->|"deploys"| node_challenge_svc
node_compose -->|"deploys"| node_monitor_svc
node_compose -->|"deploys"| node_agentic_svc
node_compose -->|"deploys"| node_clock_svc
node_frontend_nginx -->|"serves"| node_front_app
node_frontend_nginx -.->|"proxies"| node_auth_svc
node_backend_tests -.->|"covers"| node_auth_svc
node_backend_tests -.->|"covers"| node_challenge_svc
node_backend_tests -.->|"covers"| node_monitor_svc

click node_front_app "https://github.com/hu9o73/phishing-awareness-chatbot/tree/main/Application/pac-front"
click node_front_router "https://github.com/hu9o73/phishing-awareness-chatbot/blob/main/Application/pac-front/src/router/index.js"
click node_front_store "https://github.com/hu9o73/phishing-awareness-chatbot/blob/main/Application/pac-front/src/stores/user.js"
click node_front_dash "https://github.com/hu9o73/phishing-awareness-chatbot/tree/main/Application/pac-front/src/components/dashboard"
click node_front_modals "https://github.com/hu9o73/phishing-awareness-chatbot/tree/main/Application/pac-front/src/components/dashboard/member"
click node_front_views "https://github.com/hu9o73/phishing-awareness-chatbot/tree/main/Application/pac-front/src/views"
click node_auth_svc "https://github.com/hu9o73/phishing-awareness-chatbot/tree/main/Application/pac-back/src/authentication"
click node_auth_routes "https://github.com/hu9o73/phishing-awareness-chatbot/tree/main/Application/pac-back/src/authentication/app/api/routes/v1"
click node_auth_logic "https://github.com/hu9o73/phishing-awareness-chatbot/tree/main/Application/pac-back/src/authentication/app/services"
click node_challenge_svc "https://github.com/hu9o73/phishing-awareness-chatbot/tree/main/Application/pac-back/src/challenges"
click node_challenge_routes "https://github.com/hu9o73/phishing-awareness-chatbot/tree/main/Application/pac-back/src/challenges/app/api/routes/v1"
click node_challenge_logic "https://github.com/hu9o73/phishing-awareness-chatbot/tree/main/Application/pac-back/src/challenges/app/services"
click node_monitor_svc "https://github.com/hu9o73/phishing-awareness-chatbot/tree/main/Application/pac-back/src/monitoring"
click node_monitor_routes "https://github.com/hu9o73/phishing-awareness-chatbot/tree/main/Application/pac-back/src/monitoring/app/api/routes/v1"
click node_monitor_logic "https://github.com/hu9o73/phishing-awareness-chatbot/tree/main/Application/pac-back/src/monitoring/app/services"
click node_agentic_svc "https://github.com/hu9o73/phishing-awareness-chatbot/tree/main/Application/pac-back/src/agentic"
click node_agentic_routes "https://github.com/hu9o73/phishing-awareness-chatbot/tree/main/Application/pac-back/src/agentic/app/api/routes/v1"
click node_agentic_logic "https://github.com/hu9o73/phishing-awareness-chatbot/tree/main/Application/pac-back/src/agentic/app/services"
click node_clock_svc "https://github.com/hu9o73/phishing-awareness-chatbot/tree/main/Application/pac-back/src/clocking"
click node_compose "https://github.com/hu9o73/phishing-awareness-chatbot/blob/main/Application/docker-compose-full-build.yaml"
click node_frontend_nginx "https://github.com/hu9o73/phishing-awareness-chatbot/blob/main/Application/pac-front/nginx.conf"
click node_backend_tests "https://github.com/hu9o73/phishing-awareness-chatbot/tree/main/Application/pac-back/tests/unit_tests"

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_front_app,node_front_router,node_front_store,node_front_dash,node_front_modals,node_front_views toneBlue
class node_auth_svc,node_auth_routes,node_auth_logic,node_challenge_svc,node_challenge_routes,node_challenge_logic,node_monitor_svc,node_monitor_routes,node_monitor_logic,node_agentic_svc,node_agentic_routes,node_agentic_logic,node_clock_svc toneAmber
class node_compose,node_frontend_nginx,node_backend_tests toneMint
```

## Components

### Frontend

Vue 3 dashboard SPA

- [PAC Front](https://github.com/hu9o73/phishing-awareness-chatbot/tree/main/Application/pac-front): vue spa · Single-page dashboard application · `Application/pac-front`
- [Router](https://github.com/hu9o73/phishing-awareness-chatbot/blob/main/Application/pac-front/src/router/index.js): navigation · Client-side page routing · `Application/pac-front/src/router/index.js`
- [User Store](https://github.com/hu9o73/phishing-awareness-chatbot/blob/main/Application/pac-front/src/stores/user.js): session state · Client-side user and session state · `Application/pac-front/src/stores/user.js`
- [Dashboards](https://github.com/hu9o73/phishing-awareness-chatbot/tree/main/Application/pac-front/src/components/dashboard): ui shell · Role-based dashboard layouts and views · `Application/pac-front/src/components/dashboard`
- [Workflow Modals](https://github.com/hu9o73/phishing-awareness-chatbot/tree/main/Application/pac-front/src/components/dashboard/member): ui flows · Member and admin interaction modals · `Application/pac-front/src/components/dashboard/member`
- [Views](https://github.com/hu9o73/phishing-awareness-chatbot/tree/main/Application/pac-front/src/views): page shells · Top-level app views and entry screens · `Application/pac-front/src/views`

### Backend

FastAPI microservices

- [Authentication](https://github.com/hu9o73/phishing-awareness-chatbot/tree/main/Application/pac-back/src/authentication): identity service · Users, orgs, memberships, and role access · `Application/pac-back/src/authentication`
- [Auth Routes](https://github.com/hu9o73/phishing-awareness-chatbot/tree/main/Application/pac-back/src/authentication/app/api/routes/v1): api layer · Admin, org admin, and auth endpoints · `Application/pac-back/src/authentication/app/api/routes/v1`
- [Auth Logic](https://github.com/hu9o73/phishing-awareness-chatbot/tree/main/Application/pac-back/src/authentication/app/services): service layer · Identity and organization operations · `Application/pac-back/src/authentication/app/services`
- [Challenges](https://github.com/hu9o73/phishing-awareness-chatbot/tree/main/Application/pac-back/src/challenges): workflow service · Member challenge execution and scenario access · `Application/pac-back/src/challenges`
- [Challenge Routes](https://github.com/hu9o73/phishing-awareness-chatbot/tree/main/Application/pac-back/src/challenges/app/api/routes/v1): api layer · User-facing org member and scenario endpoints · `Application/pac-back/src/challenges/app/api/routes/v1`
- [Challenge Logic](https://github.com/hu9o73/phishing-awareness-chatbot/tree/main/Application/pac-back/src/challenges/app/services): service layer · Scenario and org-member orchestration · `Application/pac-back/src/challenges/app/services`
- [Monitoring](https://github.com/hu9o73/phishing-awareness-chatbot/tree/main/Application/pac-back/src/monitoring): reporting service · Campaign progress, exchanges, and visibility · `Application/pac-back/src/monitoring`
- [Monitoring Routes](https://github.com/hu9o73/phishing-awareness-chatbot/tree/main/Application/pac-back/src/monitoring/app/api/routes/v1): api layer · Monitoring and health endpoints · `Application/pac-back/src/monitoring/app/api/routes/v1`
- [Monitoring Logic](https://github.com/hu9o73/phishing-awareness-chatbot/tree/main/Application/pac-back/src/monitoring/app/services): service layer · Reporting and email-related monitoring · `Application/pac-back/src/monitoring/app/services`
- [Agentic](https://github.com/hu9o73/phishing-awareness-chatbot/tree/main/Application/pac-back/src/agentic): ai orchestration · Agent flows, messages, and email hooks · `Application/pac-back/src/agentic`
- [Agentic Routes](https://github.com/hu9o73/phishing-awareness-chatbot/tree/main/Application/pac-back/src/agentic/app/api/routes/v1): api layer · Agentic flow, message, and hook endpoints · `Application/pac-back/src/agentic/app/api/routes/v1`
- [Agentic Logic](https://github.com/hu9o73/phishing-awareness-chatbot/tree/main/Application/pac-back/src/agentic/app/services): service layer · Agent and automation coordination · `Application/pac-back/src/agentic/app/services`
- [Clocking](https://github.com/hu9o73/phishing-awareness-chatbot/tree/main/Application/pac-back/src/clocking): specialized service · Small isolated time-based service · `Application/pac-back/src/clocking`

### Infra

Container and test orchestration

- [Compose Build](https://github.com/hu9o73/phishing-awareness-chatbot/blob/main/Application/docker-compose-full-build.yaml): deployment · Full-stack container assembly · `Application/docker-compose-full-build.yaml`
- [Nginx](https://github.com/hu9o73/phishing-awareness-chatbot/blob/main/Application/pac-front/nginx.conf): edge proxy · Serves frontend and proxies API calls · `Application/pac-front/nginx.conf`
- [Unit Tests](https://github.com/hu9o73/phishing-awareness-chatbot/tree/main/Application/pac-back/tests/unit_tests): test suite · Backend service-aligned unit tests · `Application/pac-back/tests/unit_tests`

## Connections

- PAC Front → Router: navigates · SPA routing for dashboard views
- PAC Front → User Store: session state · Reads and updates user/session state
- PAC Front → Views: renders · Top-level login and dashboard views
- Views → Dashboards: uses · Views compose role-specific dashboard shells
- Dashboards → Workflow Modals: opens · Dashboard interactions launch workflow modals
- PAC Front → Authentication: api calls · Frontend primarily talks to identity endpoints
- PAC Front → Challenges: api calls · Member workflows execute challenge flows
- PAC Front → Monitoring: api calls · Dashboard reporting queries monitoring data
- Authentication → Auth Routes: exposes · Role-based authentication and admin routes
- Auth Routes → Auth Logic: delegates · Routes delegate to service-layer operations
- Auth Logic → Authentication: uses data · Identity service owns its persistence boundary
- Challenges → Challenge Routes: exposes · User-facing challenge endpoints
- Challenge Routes → Challenge Logic: delegates · Scenario and org-member handling
- Challenge Logic → Authentication: auth dependency · Challenge workflows rely on identity context
- Challenge Logic → Agentic: orchestrates · Challenge flows can fan out to AI automation
- Monitoring → Monitoring Routes: exposes · Monitoring and health endpoints
- Monitoring Routes → Monitoring Logic: delegates · Monitoring queries and reporting logic
- Monitoring Logic → Authentication: auth dependency · Reporting is scoped by organization and member access
- Agentic → Agentic Routes: exposes · Agentic flow, message, and hook endpoints
- Agentic Routes → Agentic Logic: delegates · Route handlers call orchestration services
- Agentic Logic → Monitoring: signals · Agentic flows can emit monitoring-relevant events
- Compose Build → Authentication: deploys · Container stack includes identity service
- Compose Build → Challenges: deploys · Container stack includes challenge service
- Compose Build → Monitoring: deploys · Container stack includes monitoring service
- Compose Build → Agentic: deploys · Container stack includes AI orchestration service
- Compose Build → Clocking: deploys · Container stack includes clocking service
- Nginx → PAC Front: serves · Production edge serves built frontend
- Nginx → Authentication: proxies · Nginx forwards API requests to backend services
- Unit Tests → Authentication: covers · Tests mirror service boundaries
- Unit Tests → Challenges: covers · Tests mirror service boundaries
- Unit Tests → Monitoring: covers · Tests mirror service boundaries
