docs/development/basic/setup-development.mdx
Welcome to the LobeHub development environment setup guide.
If you have access to GitHub Codespaces, you can click the button below to enter the online development environment with just one click:
Before starting development on LobeHub, you need to install and configure some necessary software and tools in your local environment. This document will guide you through these steps.
First, you need to install the following software:
We recommend installing the extensions listed in .vscode/extensions.json for the best development experience.
After installing the above software, you can start setting up the LobeHub project.
First, you need to clone the LobeHub codebase from GitHub. Run the following command in the terminal:
git clone https://github.com/lobehub/lobehub.git
cd lobehub
Use PNPM to install the project's dependencies:
pnpm i
Copy the example environment files:
# Docker services configuration
cp docker-compose/dev/.env.example docker-compose/dev/.env
# Next.js development server configuration
cp .env.example.development .env
Edit these files as needed:
docker-compose/dev/.env - Docker services (PostgreSQL, Redis, RustFS, SearXNG).env - Next.js dev server (database connection, S3 storage, auth, etc.)Start all required services using Docker Compose:
bun run dev:docker
This will start the following services:
You can check all Docker services are running by running:
docker compose -f docker-compose/dev/docker-compose.yml ps
Execute the database migration script to create all necessary tables:
pnpm db:migrate
You should see: ✅ database migration pass.
Launch the LobeHub development server:
bun run dev
Now, you can open http://localhost:3010 in your browser, and you should see the welcome page of LobeHub. This indicates that you have successfully set up the development environment.
When running with Docker Compose development setup:
postgres://postgres@localhost:5432/lobechatredis://localhost:6379http://localhost:9000http://localhost:9001http://localhost:8180http://localhost:3010Desktop App Development — To work on the Electron desktop app:
cd apps/desktop
pnpm run dev
Mobile SPA Development — To develop the mobile web app:
bun run dev:spa:mobile
Access at http://localhost:3012
If you encounter issues, you can reset the entire stack:
# Completely reset Docker environment (delete all data and restart)
bun run dev:docker:reset
If ports are already in use:
# Check what's using the ports
lsof -i :5432 # PostgreSQL
lsof -i :6379 # Redis
lsof -i :9000 # RustFS API
lsof -i :9001 # RustFS Console
lsof -i :8180 # SearXNG
Run migrations manually when needed:
pnpm db:migrate
If you encounter dependency issues, remove all node_modules and reinstall:
bun run clean:node_modules && pnpm install
During the development process, if you encounter any issues with environment setup or have any questions about LobeHub development, feel free to ask us at any time. We look forward to seeing your contributions!