System Architecture — Technical Documentation

PRODUCTIONARCHITECTURE

Composable, event-driven system architecture. Pipeline pattern for message processing. Circuit breakers for failover. Multi-tenant workspace isolation. Enterprise-grade reliability.

9
Modules
12
Pipeline Steps
40+
API Endpoints
15
Integrations

Message Pipeline

Composable middleware architecture — each step transforms shared MessageContext

LoadContextStep

Load conversation history, workspace settings, KB metadata

01

PromptGuardStep

Injection detection, content filtering, rate limiting

02

RAGRetrievalStep

Semantic search → vector store → context enrichment

03

LLMStreamStep

Groq (primary) → OpenAI (failover) with circuit breaker

04

SentimentAnalysisStep

Keyword-based positive/neutral/negative detection

05

IntentClassifierStep

Pattern matching: FAQ, booking, sales, support, escalation

06

QualityScorerStep

Heuristic: length, citations, relevance signals → 0.0-1.0

07

LeadScoringStep

Pricing/timeline/contact signals → cumulative score

08

PersistenceStep

Save message, update conversation state, emit events

09

Composable Design Pattern

Add/remove pipeline steps without touching core engine. Steps share MessageContext — modify in-place, return control to pipeline.

Technology Stack

Production-grade components. Battle-tested reliability. Zero vendor lock-in.

Backend

FastAPI0.115
SQLAlchemy2.0
PostgreSQL17
Redis7.4
Pineconev2
ARQ0.26

Frontend

Next.js15.1
React19
TypeScript5.x
Tailwind3.4
Zustand5.x
React Query5.x

AI/ML

Groqllama-3.3
OpenAIgpt-4o
Transformerslocal
Vapiv1

Infra

AWS EC2m7i-flex
RDS PG17
Nginx1.18
ActionsCI/CD

Design Patterns

Enterprise-grade architectural patterns for reliability and maintainability

Pipeline

Composable middleware for message processing. Isolated, testable, swappable steps.

Circuit Breaker

LLM router tracks failures, auto-failover from Groq to OpenAI after threshold.

Workspace Isolation

Every DB query scoped to workspace_id. JWT tokens carry workspace context.

Event Bus

In-process pub/sub for cross-module communication. Decouples analytics, channels.

Repository

Database access abstracted. Simplifies testing and data layer migration.

Graceful Degradation

Redis failure doesn't break app. Cache, rate limiting degrade gracefully.

Interactive Documentation

Explore the API

Live endpoint testing. Complete schema definitions. Request/response examples.

Fenlo AI — Intelligent Automation Solutions