Skip to main content

Documentation Index

Fetch the complete documentation index at: https://mintlify.com/peilingjiang/b5/llms.txt

Use this file to discover all available pages before exploring further.

This guide will help you set up a local development environment for contributing to b5.

Prerequisites

Before you begin, ensure you have the following installed:
  • Bun - Fast JavaScript runtime and package manager
  • Git
  • A modern web browser (Chrome, Firefox, or Safari recommended)

Clone the Repository

Important: You must clone with submodules! b5 uses b5.js as a submodule for script rendering.
Clone the project with all submodules:
git clone --recurse-submodules https://github.com/peilingjiang/b5.git
cd b5
If you’ve already cloned without submodules, initialize them:
git submodule update --init --recursive

Installation

1

Install dependencies

Run the setup script to install all dependencies including the b5.js submodule:
bun run setup
This command runs:
  • bun install - Installs main project dependencies
  • bun run submodule - Installs b5.js submodule dependencies
2

Start development servers

Open two terminal windows in the project root directory.In the first terminal, start the CSS watcher (if you plan to modify CSS):
bun run css
In the second terminal, start the React development server:
bun start
3

Access the application

The development server should automatically open your default browser. If not, navigate to:
http://localhost:3000

Available Scripts

The following scripts are available in package.json:
# Start React development server with hot reload
bun start

# Watch and compile CSS changes
bun run css

Development Workflow

Making Changes

  1. The React development server (bun start) watches for file changes and automatically reloads
  2. The CSS watcher (bun run css) listens to CSS file changes and optimizes them in real-time
  3. Make your changes to the codebase
  4. Test your changes in the browser at localhost:3000

Code Formatting

Code is automatically formatted upon commit using git hooks. You don’t need to manually format before committing.
If you want to manually format code:
bun run format
This formats all *.{js,jsx,ts,tsx,json,md,html,css} files using Prettier.

Pre-commit Hooks

The project uses simple-git-hooks and lint-staged to automatically format code before commits:
  • Prettier runs on staged files matching the pattern
  • No manual intervention needed
  • Ensures consistent code style across the project

Project Structure

See the Architecture page for detailed information about the codebase structure.

Troubleshooting

Port Already in Use

If port 3000 is already in use, the development server will prompt you to use a different port. You can also set a custom port:
PORT=3001 bun start

Submodule Issues

If you encounter issues with the b5.js submodule:
# Update submodule to latest commit
git submodule update --remote

# Reinstall submodule dependencies
cd src/b5.js && bun install && cd ../..

CSS Not Updating

Make sure the CSS watcher is running in a separate terminal:
bun run css

Next Steps

Build docs developers (and LLMs) love