Repository and Project Structure
Relevant source files
The following files were used as context for generating this wiki page:
The Budibase repository is a monorepo that contains all the code for the Budibase platform. This structure allows for centralized management of different parts of the application, including the backend server, the application builder, and the client-side applications. The project is managed using Lerna, which helps in handling the building and publishing of the various packages that constitute the platform.
This centralized approach simplifies dependency management and ensures consistency across the different modules. The codebase is organized into distinct packages, each with a specific responsibility, facilitating a clear separation of concerns between frontend, backend, and shared logic.
Monorepo Architecture
Budibase utilizes a Lerna-managed monorepo to organize its various projects and libraries. All individual modules are located within the packages/ directory at the root of the repository. This setup enables shared dependencies and streamlined cross-package development. Imports between packages are handled using the @budibase/ scope.
Sources: README.md:129, AGENTS.md:5, AGENTS.md:7
The following diagram illustrates the high-level monorepo structure.
Core Packages
The packages/ directory contains the primary modules that make up the Budibase ecosystem. Each package serves a distinct purpose, from handling server-side logic to rendering the final user-facing application.
Sources: README.md:131-137, AGENTS.md:6
| Package | Description |
|---|---|
server | A Koa application that serves the JavaScript for the builder and deployed apps. It also provides the API for database and file system interactions. |
client | A browser-based module responsible for reading a JSON definition and rendering a live web application from it. |
builder | The client-side Svelte application for the Budibase builder, used to create and design applications. |
worker | A backend package for handling background jobs and tasks. |
backend-core | A core Node.js package containing shared backend logic. |
frontend-core | A core browser package containing shared frontend logic. |
shared-core | A package with code that can be used in both Node.js (backend) and browser (frontend) environments. |
bbui | A dedicated package for common Svelte components used across the Budibase organization. |
Sources: README.md:131-137, AGENTS.md:6, packages/bbui/README.md:3
Architectural Layers
The packages are organized into distinct architectural layers based on their execution environment: Backend (Node.js), Frontend (Browser), and Shared (isomorphic).
Sources: AGENTS.md:8-10
This diagram shows the separation of packages into Backend, Frontend, and Shared layers, with all layers depending on the shared-core package.
Backend Packages
These packages run in a Node.js environment and handle server-side logic, API endpoints, and background processing.
serverworkerbackend-core
Sources: AGENTS.md:8, i18n/README.fr.md:143-145
Frontend Packages
These packages are designed to run in the browser. They include the application builder, the runtime client for generated apps, and UI component libraries.
builderfrontend-corebbuiclient
Sources: AGENTS.md:9, i18n/README.de.md:129-131
Shared Package
This layer contains code that is environment-agnostic and can be utilized by both the backend and frontend.
shared-core
Sources: AGENTS.md:10
UI Component Library (bbui)
Budibase maintains a separate package, bbui, for all common UI components used across its frontend applications. This package uses Svelte and is developed using Svench, a tool similar to Storybook for component development and visualization.
The workflow for creating a new component in bbui is as follows:
- Create a
.sveltefile for the component. - Create a corresponding
.svenchfile for variants and testing. - Re-export the new component in
src/index.js. - Publish the package for use in other projects.
Components are designed to be reusable, use CSS custom properties for styling, and avoid outer margins to allow for flexible composition using CSS Grid or wrapper elements.
Sources: packages/bbui/README.md:3-29
Contribution and Code Style
The repository has established guidelines to ensure code quality and consistency.
- Contribution Process: The project uses the C4 (Collective Code Construction Contract) process for contributions. Changes should be submitted via pull requests on small, focused commits.
- Code Style: The project enforces a specific code style, including no semicolons, double quotes, and 2-space indentation. TypeScript is used in strict mode.
- Imports: A specific order is preferred: external imports first, followed by internal
@budibase/*packages.
Sources: packages/builder/CONTRIBUTING.md:7, AGENTS.md:20-23, CLAUDE.md:20-23