How 2ai-cx/budibase works
Major domains and components
• Frontend – The user‐facing applications:
– The Builder (packages/builder): A client-side Svelte-based application through which developers design and configure apps.
– The Client (packages/client and packages/frontend-core): Runs in the browser to render the final application based on a JSON definition. It holds UI components, theming, and layout functionality.
• Backend – The server side:
– The Server (packages/server): A Koa-based web application that provides the API endpoints for interactions, manages database and file system operations, and serves the builder/client resources.
– The Worker (packages/worker): Handles background tasks such as automation processing, integration calls, and other asynchronous operations (e.g., running automations, webhooks, or processing queued jobs).
• Shared, SDK, and Types:
– Shared-core, SDK, and Types packages (e.g., packages/shared-core, packages/sdk, packages/types, packages/string-templates) that provide common business logic, API interfaces, type definitions, helper utilities, and integration points across the system.
• CLI and Integration Tools:
– The CLI (packages/cli) provides utility scripts and command-line tools.
• DevOps & Hosting:
– The “hosting” directory and Docker/Kubernetes charts contain deployment configurations, Dockerfiles, Helm charts, and infrastructure scripts.
Out component interactions and data flow
• The Builder (frontend) communicates with the Server via RESTful API endpoints (and possibly websockets for real-time updates) to store app definitions, manage automated workflows, and deploy changes.
• The Client (runtime application) fetches its JSON definition (that may include API routes, UI configuration, and styling) from the Server and renders the live, responsive app.
• The Server not only serves the web apps but also handles data persistence (integrating with databases like CouchDB and others as suggested by files in packages/server/src/db) and communications with external data sources.
• The Worker processes background automation tasks (as seen from automation steps in packages/server/src/automations, and tests around these modules) and integrates with third-party services.
• Shared libraries, SDKs, and type packages ensure consistency of business logic (e.g., event handling, row actions, licensing) across the builder, client, server, and worker.
• External integrations – For data sources and connectivity (e.g., integrations with MongoDB, Postgres, DynamoDB, REST APIs) – are defined within server integrations and also in the types/SDK modules.
Architectural patterns and design principles
• Monorepo organization using Lerna aids in separation of concerns across modular packages while promoting reuse of common modules.
• Clear separation between presentation (builder and client) and logic/data layers (server, worker, integrations).
• Use of middleware patterns in the server (launched by Koa) and in routing among API controllers.
• Asynchronous processing of tasks via the worker, with event emitters and queues connecting with the main server application.
• Integration of a rich type system and shared API contracts (via packages/types and packages/sdk) which ensures consistency between client–server communications.