The Problem

Companies often keep data in separate systems—databases, billing, SSO, logs—without a unified view. Querying across those silos requires custom tooling and manual integration. Helix Foundry centralises data from common services, builds a single ontology, and lets users ask questions locally using AI, eliminating external hosting and third‑party data exposure.

What This Does

Helix Foundry is a local‑first data workspace built on HelixDB and DuckDB.

  • The backend (apps/api) is a TypeScript/Node Express server that exposes REST endpoints under /api/*. The key entry point is apps/api/src/server.ts, which loads routes from apps/api/src/routes/*, sets up middleware (apps/api/src/middleware.ts), and starts the HTTP listener.
  • The frontend (apps/web) is a Vite‑powered React app. The root is apps/web/src/main.tsx, which renders the Shell component (apps/web/src/shell/Shell.tsx) and wires the REST client (apps/web/src/api.ts).
  • Data ingestion is handled by connectors defined in apps/api/src/connectors.ts and executed by the worker process (apps/api/src/worker.ts). The worker pulls data from sources, stores it in HelixDB, and feeds DuckDB for analytics.
  • The AI layer is provided by the services/executor package (services/executor/src/server.ts) which exposes a simple HTTP API to run queries against the local model (Ollama or a cached qwen3:4b model).

How It Is Wired

ENTRY POINTS
 ├─ apps/api/src/server.ts -> Express app
 ├─ apps/web/src/main.tsx  -> React entry

INTERNAL CALL GRAPH
 ├─ server.ts
 │   ├─ app.ts (sets up routes)
 │   │   ├─ routes/analyst.ts, data.ts, ontology.ts, pipelines.ts, workspace.ts
 │   │   └─ uses connectors.ts for data sync
 │   └─ worker.ts (spawned via child_process)
 │       └─ source-sync.ts → connectors.ts → HelixDB writes
 ├─ services/executor/src/server.ts
 │   └─ engine.ts → runner.ts → executes DuckDB queries
 └─ packages/sdk/src/index.ts
     └─ exposes client helpers used by the browser

WHAT THIS CODE TOUCHES OUTSIDE ITSELF
 ├─ HelixDB (local key‑value store) accessed via `packages/sdk/src/ontology.ts`
 ├─ DuckDB (embedded SQL engine) queried through `services/executor/src/engine.ts`
 ├─ Docker (compose) orchestrates the database, worker, executor, and optional Ollama
 └─ Filesystem – writes `.env`, downloads models (≈2.5 GB), and persists DuckDB files in `./data/`

FILE RESPONSIBILITIES
 ├─ `apps/api/src/server.ts` – HTTP server bootstrap
 ├─ `apps/api/src/app.ts` – route configuration
 ├─ `apps/api/src/connectors.ts` – adapter definitions (PostgreSQL, Stripe, WorkOS, PostHog)
 ├─ `apps/api/src/worker.ts` – background job runner
 ├─ `services/executor/src/server.ts` – expose `/execute` endpoint
 ├─ `services/executor/src/engine.ts` – run SQL against DuckDB
 ├─ `apps/web/src/api.ts` – fetch helper for the browser
 └─ `apps/web/src/shell/Shell.tsx` – main layout and routing

The call chain for a typical analytics query:

HTTP GET /api/pipelines → app.ts → pipelines.ts → data-jobs.ts → HelixDB → executor → DuckDB → response

Only a handful of functions (`app.ts`, `engine.ts`) have broad blast radius; most logic is modularised in connector files.

## How To Use It  
### Setup  
```bash
git clone https://github.com/moses-y/helix-foundry.git
cd helix-foundry
./scripts/setup.sh --compose

setup.sh writes fresh keys to .env (if missing), builds the Docker image, pulls HelixDB, Ollama, and the qwen3:4b model, and brings up the stack. The first run may take several minutes.

Configuration

  • .env.example lists required variables: PUBLIC_PORT, PUBLIC_ORIGIN, HELIXDB_URL, DUCKDB_PATH, OLLAMA_HOST.
  • Add your own credentials in the browser during onboarding (e.g., PostgreSQL DSN, Stripe API key).

Running

The server starts automatically via Docker Compose. Health can be checked:

curl -fsS http://localhost:3001/api/health
# {"ok":true,"service":"helix-foundry"}

Open http://localhost:3001 to access the UI.

Ports

If 3001 is occupied, create .env first, set PUBLIC_PORT and PUBLIC_ORIGIN, then re‑run ./scripts/setup.sh --compose.

Real‑World Use

A data‑engineering team can spin up a local instance, connect to their internal PostgreSQL and Stripe, and immediately query:

import { useQuery } from 'helix-foundry/sdk';

const { data } = useQuery(`
  SELECT users.email, invoices.total
  FROM users JOIN invoices ON users.id = invoices.user_id
  WHERE invoices.paid = true;
`);

The query is executed by the embedded DuckDB engine, returning results without any external API calls.

Code Health & Issues

  • Tests: 40 unit and integration tests (tests/*.ts), covering API routes and connector logic.
  • CI: GitHub Actions workflow (.github/workflows/ci.yml) runs lint, test, and build.
  • Licences: All packages are MIT‑licensed; LICENSE present at repo root.
  • Missing: No type‑coverage report; documentation is in docs/.

No critical defects were found in static analysis. The repo follows a clear module graph with minimal cycles.

The Bottom Line

Helix Foundry delivers a cohesive, local data workspace that integrates common services and provides AI‑powered querying without external hosting. The architecture is clean: a small set of back‑end entry points, modular connectors, and a dedicated executor service. It is well‑tested and CI‑protected, making it suitable for teams that need a quick local data sandbox or a prototype of a unified data layer. The main learning curve lies in Docker and the optional Ollama model download, but the provided scripts hide most complexity.