-
Notifications
You must be signed in to change notification settings - Fork 0
Developer Setup Guide
This guide provides step-by-step instructions to set up the development environment for the Digitization Toolkit project. The purpose is to ensure consistency across development environments and streamline the onboarding process for new contributors.
Core tools needed, regardless of OS:
-
Git
- Check if Git is installed by running
git --versionin your terminal. - If not installed, follow the instructions for your OS:
- macOS:
brew install git(or Xcode command line tools) - Windows: Download and install from the official Git website
- Linux (Debian and Derivatives):
sudo apt install git
- macOS:
- Check if Git is installed by running
-
Docker Desktop
- macOS: Download from Docker's official site
- Windows: Download from Docker's official site
- Linux: Install Docker Engine (
curl -fsSL https://get.docker.com | sh) anddocker compose plugin. -
After install: Run
docker --versionanddocker compose versionto verify installation.
Docker images contain all necessary dependencies (even Node and Python), so no additional installations are needed.
When cloning the repository, ensure you include submodules:
git clone --recurse-submodules git@github.com:UCSB-AMPLab/digitization-toolkit-software.git
cd digitization-toolkit-softwareVerify you have this structure:
.
├── backend # FastAPI backend
├── docker-compose.yml
├── docs
├── frontend # Svelte frontend
├── LICENSE
├── README.md
└── wikiThe toolkit uses a hybrid architecture:
- Database + Frontend: Run in Docker containers
- Backend: Run natively on Raspberry Pi (for camera access) or in Docker (for development)
From the root of the repository, run:
docker compose --profile with-backend up --buildThis will:
- Build the database service (PostgreSQL, port 5432)
- Build the backend service (FastAPI + Uvicorn, port 8000)
- Build the frontend service (SvelteKit + Vite, port 5173)
- Mount your local code inside the containers for live reloading
Start the database and frontend:
docker compose up -dIn a separate terminal, start the native backend:
./scripts/run_backend_native.shThe script will:
- Activate the Python virtual environment
- Verify database connectivity
- Detect available cameras
- Start the FastAPI backend with hot-reload
Why native? Camera access requires Raspberry Pi-specific system libraries (libcamera, picamera2, pykms) that are difficult to replicate in Docker.
Open your browser and navigate to http://localhost:8000/health. You should see:
{"status": "ok"}Open your browser and navigate to http://localhost:5173. You should expect to see:
Digitization Toolkit
API says: ok
-
Port already in use: If ports 5432, 8000, or 5173 are occupied, stop the conflicting services or change the ports in
docker-compose.yml. -
"API says: unavailable": The frontend briefly shows this during SSR before client-side hydration. This is normal. If it persists:
- Check backend is running:
curl http://localhost:8000/health - Verify DATABASE_HOST in
.envmatches your setup (localhost for native, db for Docker)
- Check backend is running:
- Camera not detected: Camera access requires the native backend on Raspberry Pi. Docker backend cannot access cameras.
- Hot reloading not working: Restart the containers:
docker compose down && docker compose up --buildFor native backend:
# Stop with Ctrl+C, then restart
./scripts/run_backend_native.shWhen you're done coding, stop the containers with:
docker compose downYou can also use the GUI in Docker Desktop to stop/start containers.