This guide helps you set up Codebuff for local development if you want to contribute to the project or run it locally.
-
Install Bun: Follow the Bun installation guide
-
Install direnv: This manages environment variables automatically
- macOS:
brew install direnv - Ubuntu/Debian:
sudo apt install direnv - Other systems: See direnv installation guide
- macOS:
-
Hook direnv into your shell:
- For zsh:
echo 'eval "$(direnv hook zsh)"' >> ~/.zshrc && source ~/.zshrc
- For bash:
echo 'eval "$(direnv hook bash)"' >> ~/.bashrc && source ~/.bashrc
- For fish:
echo 'direnv hook fish | source' >> ~/.config/fish/config.fish && source ~/.config/fish/config.fish
- For zsh:
-
Restart your shell: Run
exec $SHELL(or manually kill and re-open your terminal). -
Install Docker: Required for the web server database
-
Clone and navigate to the project:
git clone <repository-url> cd codebuff
-
Set up Infisical for secrets management:
npm install -g @infisical/cli infisical login
When prompted, select the "US" region, then verify setup:
infisical secrets
-
Configure direnv:
direnv allow
This automatically manages your PATH and environment variables. The
.envrcfile is already committed to the repository and sets up the correct PATH to use the project's bundled version of Bun. -
Install dependencies:
bun install
-
Start the development services:
Terminal 1 - Backend server:
bun run start-server
Terminal 2 - Web server (requires Docker):
bun run start-web
Terminal 3 - Client:
bun run start-client
After direnv setup, you can run tests from any directory:
bun test # Runs with secrets automatically
bun test --watch # Watch mode
bun test specific.test.ts # Run specific test fileIf direnv isn't working:
- Ensure it's properly hooked into your shell (see Prerequisites step 3)
- Run
direnv allowin the project root - Check that
.envrcexists and has the correct content - Restart your terminal if needed
For more troubleshooting help, see our documentation or join our Discord community.