This guide is for developers working on Open Notebook. For end-user documentation, see README.md and docs/.
# 1. Clone and setup
git clone https://github.com/lfnovo/open-notebook.git
cd open-notebook
# 2. Copy environment files
cp .env.example .env
cp .env.example docker.env
# 3. Install dependencies
uv sync
# 4. Start all services (recommended for development)
make start-all
| Workflow | Use Case | Speed | Production Parity |
|---|---|---|---|
Local Services (make start-all) | Day-to-day development, fastest iteration | ⚡⚡⚡ Fast | Medium |
Docker Compose (make dev) | Testing containerized setup | ⚡⚡ Medium | High |
Local Docker Build (make docker-build-local) | Testing Dockerfile changes | ⚡ Slow | Very High |
Multi-platform Build (make docker-push) | Publishing releases | 🐌 Very Slow | Exact |
Best for: Daily development, hot reload, debugging
# Start database
make database
# Start all services (DB + API + Worker + Frontend)
make start-all
# Just the database
make database
# Just the API
make api
# Just the frontend
make frontend
# Just the worker
make worker
# See what's running
make status
# Stop everything
make stop-all
Best for: Testing containerized setup, CI/CD verification
# Start with dev profile
make dev
# Or full stack
make full
docker-compose.dev.yml - Development setupdocker-compose.full.yml - Full stack setupdocker-compose.yml - Base configurationBest for: Verifying Dockerfile changes before publishing
# Build production image for your platform only
make docker-build-local
This creates two tags:
lfnovo/open_notebook:<version> (from pyproject.toml)lfnovo/open_notebook:localdocker run -p 5055:5055 -p 3000:3000 lfnovo/open_notebook:local
# 1. Test locally first
make docker-build-local
# 2. If successful, push version tag (no latest update)
make docker-push
# 3. Test the pushed version in staging/production
# 4. When ready, promote to latest
make docker-push-latest
| Command | What It Does | Updates Latest? |
|---|---|---|
make docker-build-local | Build for current platform only | No registry push |
make docker-push | Push version tags to registries | ❌ No |
make docker-push-latest | Push version + update v1-latest | ✅ Yes |
make docker-release | Full release (same as docker-push-latest) | ✅ Yes |
linux/amd64, linux/arm64-single)pyproject.toml# Create and push git tag matching pyproject.toml version
make tag
# Run linter with auto-fix
make ruff
# Run type checking
make lint
# Run tests
uv run pytest tests/
# Clean cache directories
make clean-cache
make start-allmake ruff and make lintmake docker-build-localmake start-allmake docker-build-local# Add Python dependency
uv add package-name
# Update dependencies
uv sync
# Frontend dependencies
cd frontend && npm install package-name
Open Notebook supports internationalization. To add a new language:
Create locale file: Copy an existing locale as template
cp frontend/src/lib/locales/en-US/index.ts frontend/src/lib/locales/pt-BR/index.ts
Translate all strings in the new file. The structure includes:
common: Shared UI elements (buttons, labels)notebooks, sources, notes: Feature-specific stringschat, search, podcasts: Module-specific stringsapiErrors: Error message translationsRegister the locale in frontend/src/lib/locales/index.ts:
import { ptBR } from './pt-BR'
export const locales = {
'en-US': enUS,
'zh-CN': zhCN,
'zh-TW': zhTW,
'pt-BR': ptBR, // Add your locale
}
Add date-fns locale in frontend/src/lib/utils/date-locale.ts:
import { zhCN, enUS, zhTW, ptBR } from 'date-fns/locale'
const LOCALE_MAP: Record<string, Locale> = {
'zh-CN': zhCN,
'zh-TW': zhTW,
'en-US': enUS,
'pt-BR': ptBR, // Add your locale
}
Test: Switch languages using the language toggle in the UI header.
Database migrations run automatically when the API starts.
migrations/XXX_description.surqlmigrations/XXX_description_down.surql# Check status
make status
# Check database
docker compose ps surrealdb
# View logs
docker compose logs surrealdb
# Restart everything
make stop-all
make start-all
# Find process using port
lsof -i :5055
lsof -i :3000
lsof -i :8000
# Kill stuck processes
make stop-all
# Verify SurrealDB is running
docker compose ps surrealdb
# Check connection settings in .env
cat .env | grep SURREAL
# Clean Docker cache
docker builder prune
# Reset buildx
make docker-buildx-reset
# Try local build first
make docker-build-local
open-notebook/ ├── api/ # FastAPI backend ├── frontend/ # Next.js React frontend ├── open_notebook/ # Python core library │ ├── domain/ # Domain models │ ├── graphs/ # LangGraph workflows │ ├── ai/ # AI provider integration │ └── database/ # SurrealDB operations ├── migrations/ # Database migrations ├── tests/ # Test suite ├── docs/ # User documentation └── Makefile # Development commands
See component-specific CLAUDE.md files for detailed architecture:
# .env file
SURREAL_URL=ws://localhost:8000
SURREAL_USER=root
SURREAL_PASS=root
SURREAL_DB=open_notebook
SURREAL_NS=production
# AI Provider (at least one required)
OPENAI_API_KEY=sk-...
# OR
ANTHROPIC_API_KEY=sk-ant-...
# OR configure other providers (see docs/5-CONFIGURATION/)
See docs/5-CONFIGURATION/ for complete configuration guide.
make start-all instead of Docker for daily workmake database)make docker-build-local only when testing Dockerfile changes# Stop unused services
make stop-all
# Clean up Docker
docker system prune -a
# Clean Python cache
make clean-cache
Last Updated: January 2025