How layeddie/ahpta works
Main Components
a. Frontend Layer:
• Phoenix LiveView UI (assets/js and lib/ahpta_web/live)
• WebSocket connections for real-time updates
• TailwindCSS for styling (assets/css)
b. Backend Layer:
• Phoenix Web Server (lib/ahpta_web)
• Authentication System (lib/ahpta/accounts)
• Core Business Logic Modules:
• Conversations (lib/ahpta/conversations)
• Messages (lib/ahpta/messages)
• Bots (lib/ahpta/bots)
c. External Services:
• OpenAI Integration (lib/ahpta/openai_mock.ex)
• QDrant Vector Database (lib/ahpta/qdrant.ex)
• Email Service (lib/ahpta/mailer.ex)
d. Data Layer:
• PostgreSQL Database (indicated by presence of priv/repo/migrations)
[Client Layer (Browser)]
• ↕
[Frontend Layer (Phoenix LiveView)]
• ↕
[Backend Layer (Phoenix)]
• ↕
[Data & External Services Layer]
Component Relationships
a. User Flow:
• Browser → LiveView (WebSocket connection)
• LiveView → User Authentication
• LiveView → Conversation Management
• LiveView → Message Management
• LiveView → Bot Management
b. Bot Integration:
• Bot Module → OpenAI Service
• Bot Module → QDrant Vector DB
• Bot Module → Message System
c. Data Flow:
• All Core Modules → PostgreSQL Database
• Message System → QDrant (for vector storage)
• User System → Mailer (for notifications)
Implementation Details to Note
• Database schema representations for key tables
• Authentication flow with special emphasis
• WebSocket connections explicitly