$ show hexabot-ai/Hexabot
Hexabot is a full-stack conversational AI platform for building and managing agentic chatbots with workflow automation. The system provides a visual workflow editor (based on xyflow) for designing multi-step flows, supports multiple messaging channels (web, console, and extensible), integrates with AI models via the Vercel AI SDK and Ollama, and includes a CMS with RAG (Retrieval-Augmented Generation) capabilities. It also features a memory system for context persistence, MCP (Model Context Protocol) integration for external tool discovery, audit logging with pluggable backends, analytics dashboards, and license enforcement via Lemon Squeezy. The architecture is a monorepo with seven packages: `api` (NestJS + TypeORM backend), `frontend` (React + MUI admin panel), `widget` (embeddable chat widget), `cli` (project lifecycle management), `agentic` (core workflow engine with DSL and step executors), `graph` (reusable workflow graph component), and `types` (shared Zod schemas). Key entry points include the API bootstrap (`main.ts`), the frontend app (`main.tsx`), the widget (`ChatWidget.tsx`), and the CLI (`index.ts`). Primary data flows involve inbound messages from channels being routed through the channel service to the workflow engine, which executes actions (AI generation, messaging, web requests, etc.) and produces outbound responses. External dependencies include PostgreSQL/SQLite, Redis (optional), Vercel AI SDK, MCP servers, and Lemon Squeezy for licensing. The codebase demonstrates strong engineering practices with generic CRUD abstractions, dynamic provider injection for extensions, Zod-based validation and JSON Schema generation, and a sophisticated graph layout engine. It is actively maintained with a comprehensive test suite and CI/CD pipelines.
The LLM identified 5 files worth highlighting for reuse:
Core workflow execution engine that orchestrates step executors (conditional, parallel, loop, task), handles suspension/continuation, emits lifecycle events, and manages runtime control. Demonstrates a clean state-machine pattern for complex multi-step automation and is isolated enough to be extracted into a standalone workflow runtime library.
ELK-based automatic graph layout with multiple post-processing passes for branch symmetry, group alignment, trailing placeholder flow, and start-axis alignment. This component encapsulates sophisticated graph drawing logic that can be reused in any node-based editor requiring auto-layout, independent of the workflow domain.
Generic CRUD service for TypeORM entities providing create, update, delete, find, count, and pagination with event emission, caching, and populate support. It is fully decoupled from business logic and can be reused for any entity by extending the base class, demonstrating a clean template method pattern.
Generic frontend hook for fetching paginated, sorted, and filtered data from REST APIs with TanStack Query caching and normalization. It abstracts away API client calls, error handling, and cache merging, making it reusable across any entity list view in the application.
Pluggable audit exporter that maps SDK audit logs to local database records. Part of a strategy pattern with multiple backends (database, safe, noop), this component demonstrates clean separation of concerns and can be extracted for any application requiring configurable audit logging.