System Architecture Overview
Relevant source files
The following files were used as context for generating this wiki page:
Budibase is an open-source, low-code platform for building single-page applications. Its architecture is designed as a monorepo, managed by Lerna, which separates concerns into distinct packages for the backend server, the application builder frontend, the deployed application client, and shared libraries. This structure facilitates a clear separation between development-time tooling and runtime application logic.
The system is broadly divided into backend (Node.js) and frontend (browser) packages. The backend, primarily the server package, is a Koa application responsible for API services, data source interactions, and serving the frontend assets. The frontend consists of the builder, a Svelte application for creating apps, and the client, which renders the final applications from a JSON definition.
Monorepo Structure
The Budibase codebase is organized as a Lerna monorepo, with all major components residing as packages within the packages/ directory. This approach allows for shared dependencies and streamlined management of the different parts of the system. Imports between these internal packages use the @budibase/ scope.
The following diagram illustrates the high-level organization of the main packages within the monorepo.
Sources: AGENTS.md
Core Packages
The system is composed of several key packages, each with a specific responsibility. They are categorized based on their execution environment: backend, frontend, or shared.
| Package | Environment | Description |
|---|---|---|
packages/server | Backend (Node.js) | A Koa application that serves the builder and client applications. It provides the API for interacting with the database, file system, and external data sources. |
packages/worker | Backend (Node.js) | A backend package responsible for handling background tasks and automations. |
packages/backend-core | Backend (Node.js) | Contains core functionalities utilized by the backend packages. |
packages/builder | Frontend (Browser) | A Svelte application that provides the user interface for building and designing Budibase applications. |
packages/client | Frontend (Browser) | A module that runs in the browser, responsible for reading a JSON definition and rendering it into a live, functional single-page application. |
packages/frontend-core | Frontend (Browser) | Contains core functionalities utilized by the frontend packages. |
packages/bbui | Frontend (Browser) | A Svelte-based UI component library containing common components used across the builder and client. |
packages/shared-core | Shared | A library of code that can be used by both Node.js (backend) and browser (frontend) packages. |
Sources: README.md, AGENTS.md, packages/bbui/README.md, i18n/README.de.md
High-Level Architectural Flow
The Budibase platform operates through a distinct flow from app creation to app execution. A developer uses the builder to design an application, which communicates with the server API. The server persists the application's design as a JSON definition. When an end-user accesses the application, the client module fetches this JSON definition and dynamically renders the single-page application in their browser.
This diagram shows the interaction between the main components.
Sources: README.md, i18n/README.fr.md
Frontend Architecture
UI Component Library (bbui)
The bbui package is a critical part of the frontend architecture, providing a centralized library of reusable Svelte components. This ensures a consistent look and feel across the Budibase ecosystem, including the builder and the final client applications.
- Technology: Svelte
- Development Environment: Uses
Svench, a tool similar to Storybook, for component development and visualization with HMR. - Styling: Components are styled using CSS custom properties (variables) to allow for easy theming and customization.
- Dependencies: It depends on
@spectrum-cssfor base styling and various svelte-related utilities.
Sources: packages/bbui/README.md, packages/bbui/package.json
Version Checking and System Maintenance
The frontend includes mechanisms for system-level tasks like version checking and displaying maintenance information.
Version Check
The builder settings include a page to check the current and latest Budibase versions. This is accomplished by making two separate API calls: one to an internal Budibase API endpoint and another to the public GitHub API.
The sequence diagram below illustrates this process.
Maintenance Mode
Both the builder and the client can enter a maintenance mode if the system detects a critical issue with the installation. For example, if an outdated CouchDB version is detected (SQS_MISSING), a maintenance screen is displayed.
- Builder Maintenance Screen: Provides detailed information and a link to migration guides for the administrator.
- Client Maintenance Screen: Shows a generic message to the end-user, advising them to contact their administrator.
This demonstrates a system-wide state that affects both the development and runtime environments.
Sources: packages/builder/src/pages/builder/maintenance/index.svelte, packages/client/src/components/MaintenanceScreen.svelte