How hu9o73/phishing-awareness-chatbot works
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: pac-front PAC Front · authentication Authentication · docker-compose-full-build.yaml Compose Build · monitoring Monitoring
Components 22
Frontend
Vue 3 dashboard SPA
- PAC Front · Single-page dashboard application
Application/pac-front - Router · Client-side page routing
Application/pac-front/src/router/index.js - User Store · Client-side user and session state
Application/pac-front/src/stores/user.js - Dashboards · Role-based dashboard layouts and views
Application/pac-front/src/components/dashboard - Workflow Modals · Member and admin interaction modals
Application/pac-front/src/components/dashboard/member - Views · Top-level app views and entry screens
Application/pac-front/src/views
Backend
FastAPI microservices
- Authentication · Users, orgs, memberships, and role access
Application/pac-back/src/authentication - Auth Routes · Admin, org admin, and auth endpoints
Application/pac-back/src/authentication/app/api/routes/v1 - Auth Logic · Identity and organization operations
Application/pac-back/src/authentication/app/services - Challenges · Member challenge execution and scenario access
Application/pac-back/src/challenges - Challenge Routes · User-facing org member and scenario endpoints
Application/pac-back/src/challenges/app/api/routes/v1 - Challenge Logic · Scenario and org-member orchestration
Application/pac-back/src/challenges/app/services - Monitoring · Campaign progress, exchanges, and visibility
Application/pac-back/src/monitoring - Monitoring Routes · Monitoring and health endpoints
Application/pac-back/src/monitoring/app/api/routes/v1 - Monitoring Logic · Reporting and email-related monitoring
Application/pac-back/src/monitoring/app/services - Agentic · Agent flows, messages, and email hooks
Application/pac-back/src/agentic - Agentic Routes · Agentic flow, message, and hook endpoints
Application/pac-back/src/agentic/app/api/routes/v1 - Agentic Logic · Agent and automation coordination
Application/pac-back/src/agentic/app/services - Clocking · Small isolated time-based service
Application/pac-back/src/clocking
Infra
Container and test orchestration
- Compose Build · Full-stack container assembly
Application/docker-compose-full-build.yaml - Nginx · Serves frontend and proxies API calls
Application/pac-front/nginx.conf - Unit Tests · Backend service-aligned unit tests
Application/pac-back/tests/unit_tests
Connections 31
- 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