How hubtype/botonic works
Main Components
• CLI Interface: Represented by the “botonic-cli” package (located in packages/botonic-cli) that provides commands (new, serve, deploy, etc.) and orchestrates project creation and local development.
• Core Engine: Depicted by “botonic-core” which contains the routing, event models, bot logic, handoff, and internal models. This is the heart of processing message events and driving the conversation flow.
• Frontend (UI Layer): The “botonic-react” package embodies the client-side chatbot UI. It includes components for webchat, multichannel integration, and testing elements.
• Plugins and Extensions: Various plugin packages integrate functionalities such as analytics (Google Analytics, Segment, Dashbot), CMS connections (Contentful, etc.), and NLU capabilities (Dialogflow, Watson, Luis, Inbenta). These plugins extend the core engine to connect to external services.
• Bundlers and DX Tools: Packages like “botonic-dx-bundler-rspack”, “botonic-dx-bundler-webpack”, and “botonic-dx” show how the code is built, bundled, and prepared for production deployments.
• Examples & Documentation: The “examples” folder contains several bot project examples showcasing different approaches (e.g., blank, booking-platform, childs, custom-webchat, etc.). The “docs” folder holds comprehensive documentation, component guides, and technical details.
Relationships and Interactions
• The CLI tool (botonic-cli) acts as the entry point for developers, allowing them to scaffold new projects (via “botonic new”), serve the application locally, and deploy it.
• The CLI invokes the Core Engine (botonic-core) which manages conversational flows, routes incoming messages, and triggers bot actions.
• The Core Engine communicates with various Plugins to handle functions such as analytics tracking, content management, and natural language understanding.
• Data flows toward the Frontend (botonic-react) where the React components manage webchat UI, display messages, handle interactive components (e.g., carousels, buttons, multimedia), and synchronize with backend events.
• External services (messaging platforms like WhatsApp, Facebook Messenger, etc.) integrate with the bot infrastructure, usually via webhooks or serverless functions, as supported by the core and plugins.
• Build scripts, tests, CI workflows (under .github/workflows, scripts/ci, etc.) ensure continuous integration and deployment of the framework, verifying unit tests and integration tests across components.
Architectural Patterns and Design Principles
• Modular Architecture: Each part of the system (CLI, core, front-end, plugins) is separated into distinct packages, promoting reusability and easy maintenance.
• Plugin-Based Extensibility: The design encourages adding integrations as independent modules which interact with the core bot engine.
• Full-Stack Separation: Emphasis on decoupling the conversational logic (backend/serverless core) from the user interface (React based frontend), making it easier to swap or update either layer without affecting the other.
• Use of Standard Tools: Technologies like React, serverless architecture, and CI/CD pipelines (with GitHub Actions) are used for development, testing, and deploying the framework.