Development Setup
Prerequisites
Node.js (Version: >=20.6)
Bun (Version: >=1.2.1)
Environment Setup
Our development environment is managed through nix-shell
, which ensures consistent dependencies across all development machines.
To get started:
Enter the development environment:
Set up the GitBook repository:
Start the development server:
Available Commands
GitBook Development
setup
- Clone and setup GitBook repositorysetup-force
- Force setup (removes existing directory)update
- Update existing GitBook repositoryrebuild
- Rebuild GitBook packages if there are module errorsdev
- Start the development servergformat
- Format GitBook codebaseglint
- Lint GitBook codebase
Markdown Formatting
fmt
- Format Markdown fileslint
- Lint Markdown filescheck
- Check formatting
Troubleshooting
Module Resolution Errors
If you encounter errors like:
Run the rebuild script:
This script:
Cleans previous build artifacts
Reinstalls dependencies with
bun install --force
Rebuilds all packages
After completion, try running dev
again to start the development server.
Repository Already Exists
If you get an error about the GitBook directory already existing:
Use one of these commands:
update
- Pull latest changes if the repository existssetup-force
- Remove existing directory and set up fresh
Development Server
The GitBook development server will be available at:
You can access any published GitBook space by prefixing its URL with http://localhost:3000/url/
.
For example:
http://localhost:3000/url/docs.gitbook.com
http://localhost:3000/url/open-source.gitbook.io/midjourney
Last updated