Skip to content

Development

github-actions[bot] edited this page Dec 6, 2026 · 1 revision

Prerequisites

  • Go (version from backend/go.mod, currently 1.26)
  • Node.js 26 and npm (the version CI and the image use)
  • Docker with buildx (optional, for images)
  • heif-convert from libheif (optional, for HEIC uploads outside Docker)
  • make

Run locally

git clone https://github.com/jnanadarshan/homevault.git
cd homevault
make install     # go mod tidy + npm install
make dev         # backend on :59234, Next.js dev server on :5959

Open http://localhost:5959. make dev runs scripts/dev.sh, which builds and starts the backend with BACKEND_PORT=59234, matching the frontend proxy's default BACKEND_URL, and stops both on Ctrl+C. Local data goes to backend/data/ (git-ignored).

Running the parts separately:

# Terminal 1: API
cd backend
BACKEND_PORT=59234 LOG_FORMAT=console LOG_LEVEL=debug go run ./cmd/server

# Terminal 2: UI
cd frontend
npm run dev

If you run the backend on another port (it defaults to 8080 when BACKEND_PORT is unset), start the frontend with BACKEND_URL=http://localhost:<port> npm run dev.

Useful make targets

Target What it does
make dev Backend and frontend with hot reload (frontend).
make build Builds the backend binary, the Next.js production bundle and the WASM sync engine.
make wasm Rebuilds frontend/public/homevault-sync.wasm from frontend/wasm/.
make start Serves the already-built app.
make stop Stops local dev processes.
make version Prints the current version.
make help Lists everything, including release targets.

Tests and checks

cd backend  && go test ./... && go vet ./...
cd frontend && npm run lint && npm run build

Building the Docker image yourself

docker build -t homevault:dev --build-arg VERSION=$(cat VERSION) .
docker run --rm -p 5959:5959 -v "$PWD/data:/homevault" homevault:dev

Multi-arch: docker buildx build --platform linux/amd64,linux/arm64 -t <you>/homevault:dev .

Database migrations

The schema lives in backend/internal/db/migrations/*.sql. The files are embedded in the binary and applied in filename order on start-up; applied files are tracked in the schema_migrations table. To change the schema, add a new file (for example 002_add_x.sql). Never edit one that has already shipped.

Adding an API endpoint

  1. Add or extend a handler in backend/internal/api/handlers/.
  2. Register the route in backend/internal/api/router.go.
  3. Add a typed function in frontend/lib/api.ts.
  4. Document it in API reference and OpenAPI spec, and in the in-app Help → API tab.

Documentation website

The site you are reading is built with Zensical from the docs/ folder and mkdocs.yml. It needs Python 3.11 or newer, and Node.js for the API explorer.

make docs          # live preview on http://127.0.0.1:8000
make docs-build    # build into site/, failing on broken links

Pushing a documentation change to main publishes it to GitHub Pages through .github/workflows/docs.yml.

Clone this wiki locally