Running from Source
Running from Source
This guide covers everything needed to get flow8 running directly from the Go source code — for local development, debugging, or building a custom binary.
Prerequisites
Go
flow8 requires Go 1.24.2. Install via the official installer at https://go.dev/dl/ or use asdf/mise for version management.
go version# go version go1.24.2 linux/amd64MongoDB
flow8 requires MongoDB as its primary database. For local development, run it via Docker:
docker run -d --name mongo -p 27017:27017 mongo:latestOr use Docker Compose (see docker-compose.dev.yml).
System Dependencies
Document processing capabilities require native binaries. Install on macOS:
brew install imagemagick tesseract libofficeOn Ubuntu/Debian:
apt-get install -y imagemagick tesseract-ocr libreofficeVerify each:
convert --version # ImageMagicktesseract --version # Tesseract OCRsoffice --version # LibreOfficeThe path to soffice is configured in .config.yaml under path.soffice. On macOS the default is /Applications/LibreOffice.app/Contents/MacOS/soffice.
Private Go Module Access
flow8 depends on github.com/osbits/gorgany, a private Go module. Set the following before running go mod download or go run:
export GOPRIVATE=git.qix.sx/gorgany/gorgany.gitexport GIT_HOST=github.comexport GIT_USER=usernameexport GIT_PASS=your_access_tokenexport GOPROXY=https://goproxy.cnConfigure Git credentials so the Go toolchain can fetch the private module:
git config --global url."https://${GIT_USER}:${GIT_PASS}@${GIT_HOST}/".insteadOf "https://${GIT_HOST}/"Environment Setup
Copy the example environment file and fill in the required values:
cp .env.example .envMinimum required values for local development:
SERVER_PORT=4454MONGODB_URI=mongodb://localhost:27017MONGODB_DB=udAPI_URL=http://localhost:4454/api/ENV_KEY_SALT=<generate 64 random hex chars>ENC_KEY_SECRET=<generate 256 random hex chars>Generate encryption keys:
# 64-char hex saltopenssl rand -hex 32
# 256-char hex secretopenssl rand -hex 128Build Commands
# Run server directly (development)go run server.go
# Build production binarygo build -o main server.go
# Run the built binary./mainRunning Tests
# Run all testsgo test ./...
# Run tests for a specific package with verbose outputgo test ./pkg/service/... -v
# Run a specific test by namego test ./pkg/plugins/layers/v2/... -run TestIterator
# Run with race detectorgo test -race ./...
# Run with coverage reportgo test -cover ./... -coverprofile=coverage.outgo tool cover -html=coverage.outGenerating the Module Catalog
To regenerate the CSV listing all 135+ modules with their metadata:
go run cmd/modulescsv/main.goOutput is written to the project root as modules.csv.
Remote Debugger (Delve)
The docker-compose.local.yml profile starts the server with the Delve debugger listening on port 2345:
COMPOSE_FILE=docker-compose.local.yml docker-compose upThe entrypoint in this profile is:
dlv --listen=:2345 --headless=true --log=true --accept-multiclient --api-version=2 exec /app/flow8coreConnect from VS Code using a launch.json remote attach configuration:
{ "type": "go", "request": "attach", "name": "Attach to flow8 (Delve)", "mode": "remote", "remotePath": "/app", "port": 2345, "host": "127.0.0.1"}This profile also includes a PostgreSQL service on port 5744 for testing database modules.
Common Development Workflow
# 1. Start dependenciesdocker-compose -f docker-compose.dev.yml up -d mongo
# 2. Set environmentsource .env # or export vars manually
# 3. Run server with live reload (using air)air -c .air.toml
# 4. Or just run directlygo run server.go