Developer Setup Guide
Relevant source files
The following files were used as context for generating this wiki page:
This guide provides a comprehensive overview for developers looking to contribute to the Budibase project. It covers the project's architecture, development environment setup, coding standards, and contribution process. Budibase is an open-source, low-code platform structured as a monorepo managed by Lerna, enabling developers to build, test, and publish various packages efficiently.
The platform is designed to be extensible, allowing developers to add new components, create automations, or even fork the project to suit their needs. For information on contributing, see the Contribution Process section. For details on the user-facing features, refer to the official Budibase Documentation.
Architecture Overview
Budibase is a monorepo managed by Lerna, with all packages located in the packages/ directory. This structure facilitates code sharing and management across different parts of the application. The packages are separated into backend (Node.js), frontend (Browser), and shared (isomorphic) modules.
Sources: README.md:121-122, AGENTS.md:5-6
Key Packages
The repository is organized into several key packages, each with a specific responsibility.
| Package | Type | Description |
|---|---|---|
@budibase/server | Backend | A Koa application that serves the builder and apps, and provides the main API. |
@budibase/worker | Backend | Handles background jobs and automations. |
@budibase/backend-core | Backend | Core backend functionalities shared between the server and worker. |
@budibase/builder | Frontend | The client-side Svelte application for building Budibase apps. |
@budibase/client | Frontend | A browser module that renders applications from their JSON definition. |
@budibase/frontend-core | Frontend | Core frontend functionalities shared between the builder and client. |
@budibase/bbui | Frontend | A shared library of common Svelte components used across the platform. |
@budibase/shared-core | Shared | Isomorphic code that can run in both Node.js and browser environments. |
Sources: README.md:123-131, AGENTS.md:7-11, packages/bbui/README.md:1-2
The following diagram illustrates the high-level package architecture and their relationships.
Sources: AGENTS.md:7-11
Environment Setup
Prerequisites
Before you begin, ensure you have the following tools installed on your system:
- Node.js: Required for running scripts and managing dependencies.
- Docker: Used for running services like databases and other dependencies in an isolated environment.
- Docker Compose: Used to orchestrate multi-container Docker applications.
Sources: examples/nextjs-api-sales/README.md:10-13, charts/budibase/README.md:7-8
Initial Setup and Commands
The project uses yarn for dependency management. The following commands are essential for the development lifecycle.
| Command | Description |
|---|---|
yarn build | Builds all packages in the monorepo. |
yarn lint | Checks the codebase for linting errors. |
yarn lint:fix | Automatically fixes linting errors. |
yarn test <filename> | Runs tests for a specific file within a package directory. |
yarn check:types | Performs a TypeScript type check across the project. |
Sources: AGENTS.md:15-19
Accessing the Local Development Server
Once the development environment is running, you can access the Budibase builder locally.
- URL:
http://localhost:10000 - Default Email:
local@budibase.com - Default Password:
cheekychuckles
Before running yarn dev, ensure that the development server is not already running.
Sources: AGENTS.md:63-66
Development Guidelines
Code Style
To maintain consistency, the project adheres to a strict code style enforced by Prettier and ESLint.
- No semicolons.
- Use double quotes for strings.
- 2-space indentation.
- TypeScript strict mode is enabled.
- Imports should be grouped with external packages first, followed by internal
@budibase/*packages. - Use
camelCasefor variables and prefix unused variables with an underscore (_). - Prefer
async/awaitover raw Promises. - Use
try/catchblocks for error handling. - Use
interfacefor objects andtypefor unions/primitives. Avoid casting toany.
Sources: AGENTS.md:23-31
Testing
- The project uses the Jest framework.
- Tests are structured with
describeanditblocks. - External services should be mocked using
nock. console.logshould not be used in tests as its output is not visible. In application code,console.logis redirected to the Pino logging framework.- For
packages/servertests, utility functions likecreateAutomationBuilderandbasicTableshould be used to construct test resources. TheTestConfigurationclass provides access to a test API.
Sources: AGENTS.md:32-39, AGENTS.md:43-51
Component Development (bbui)
The @budibase/bbui package contains all common Svelte components. It uses Svench for development, which provides a Storybook-like experience with HMR for rapid development.
To create a new component:
- Create a component file (e.g.,
MyComponent.svelte). - Create a corresponding Svench file (
MyComponent.svench) to define variants for development and testing. - Build the component, forwarding events where possible (e.g.,
<button on:click>). - Avoid adding margins to the component's outermost container.
- Re-export the new component in
src/index.js. - Publish the package and update its version in the main project.
Sources: packages/bbui/README.md:1-2, packages/bbui/README.md:8-27
Contribution Process
The project follows the C4 (Collective Code Construction Contract) process for contributions.
- Contributors should add themselves to
AUTHORS.md. - Commits should be small and focused.
- Use
rebaseinstead ofmergeto keep the commit history clean. - Pull requests should be opened as drafts and follow the
pull_request_template.mdformat. - Ensure your branch is up-to-date with
masterbefore opening a pull request.
Sources: packages/builder/CONTRIBUTING.md:3-14, AGENTS.md:55-60
System Internals
Version Checking
The Budibase builder includes a feature to check for the latest available version of Budibase. This helps users of self-hosted instances know when an update is available.
The version check is performed on the "Version" settings page. It involves two asynchronous calls:
- An internal API call to
/api/budibase/versionto get the current running version. - A
fetchrequest to the GitHub API endpointhttps://api.github.com/repos/Budibase/budibase/releases/latestto get information about the latest release.
The following sequence diagram illustrates this flow.
The page then displays the current version, the latest version tag, and the release date, along with a link to the documentation on how to update a self-hosted installation.
Sources: packages/builder/src/settings/pages/version.svelte:43-56