Prerequisites
Before you begin, ensure you have the following installed:- Node.js 22 or higher
- pnpm 10 or higher (package manager)
- Docker (for running PostgreSQL locally)
- Git (for version control)
- A GitHub account
- A GitHub OAuth App (create one here)
When creating your GitHub OAuth App, set the callback URL to
http://localhost:3000/api/auth/callback/github for local development.Setup Steps
Use the correct Node.js version
The project includes an This ensures you’re using the correct Node.js version for the project.
.nvmrc file specifying Node.js 22. If you use nvm, run:Start PostgreSQL with Docker
Better Hub uses PostgreSQL for data storage. Start it using Docker Compose:This runs PostgreSQL in the background. The database configuration is in
docker-compose.yml.Configure environment variables
Copy the example environment file and fill in the required values:Open
apps/web/.env and configure the following variables:Required Environment Variables
Required Environment Variables
DATABASE_URL- PostgreSQL connection string (provided by Docker Compose)GITHUB_CLIENT_ID- From your GitHub OAuth AppGITHUB_CLIENT_SECRET- From your GitHub OAuth AppBETTER_AUTH_SECRET- Generate a random string for session encryptionBETTER_AUTH_URL- Set tohttp://localhost:3000for local development
- AI provider keys (OpenRouter, Anthropic, etc.)
- Redis connection (Upstash)
- S3/R2 for file uploads
Install dependencies
Install all project dependencies using pnpm:This installs dependencies for all workspaces in the monorepo.
Run database migrations
Set up the database schema using Prisma:This creates all necessary database tables based on the Prisma schema.
Development Scripts
Run these commands from the monorepo root:Always run
pnpm check before pushing changes to ensure your code passes all quality checks.Troubleshooting
Port 3000 already in use
Port 3000 already in use
If port 3000 is already occupied, you can change the port by setting the
PORT environment variable:Database connection errors
Database connection errors
Ensure Docker is running and PostgreSQL is up:If the database isn’t running, restart it:
Prisma client out of sync
Prisma client out of sync
If you see Prisma-related errors, regenerate the Prisma client:
GitHub OAuth not working
GitHub OAuth not working
Verify your GitHub OAuth App settings:
- Homepage URL:
http://localhost:3000 - Authorization callback URL:
http://localhost:3000/api/auth/callback/github - Client ID and Secret match your
.envfile
Next Steps
Now that you have Better Hub running locally:- Read the Contributing Guidelines to understand the PR workflow
- Explore the Architecture Overview to understand the codebase structure
- Start building features or fixing bugs!