Skip to content

Repository files navigation

DXTA Pipeline

TypeScript monorepo for extract/transform pipelines using Temporal for workflow orchestration.

Prerequisites

Option 1: Nix (recommended)

nix develop

Provides: Node.js 24, pnpm, Biome, Temporal CLI, git, jq

Option 2: Manual

  • Node.js >= 18.17.1
  • pnpm 9.12.2
  • Temporal server

Quick Start

1. Install dependencies

pnpm install

2. Start Temporal server

temporal server start-dev

Temporal UI available at http://localhost:8233

3. Configure environment

cp .env.example .env
# Edit .env with your credentials

Required variables:

VariableUsed ByDescription
TENANT_DATABASE_AUTH_TOKENextract, transformAuth token for tenant databases
SUPER_DATABASE_URLextract, transformSuper database connection URL
SUPER_DATABASE_AUTH_TOKENextract, transformSuper database auth token
GITHUB_APP_IDextractGitHub App ID
GITHUB_APP_PRIVATE_KEYextractGitHub App private key (multiline)

Optional variables:

VariableDefaultDescription
TEMPORAL_ADDRESSlocalhost:7233Temporal server address
TEMPORAL_NAMESPACEdefaultTemporal namespace
PORT3000Orchestrator HTTP port
PER_PAGE30GitHub API pagination size
FETCH_TIMELINE_EVENTS_PER_PAGE1000Timeline events per page
EXTRACT_SCHEDULE_ENABLEDtrueEnable extract schedule
TRANSFORM_SCHEDULE_ENABLEDtrueEnable transform schedule

4. Start workers

Run in separate terminals:

# Extract worker (polls 'extract' queue)
pnpm --filter @dxta/worker-extract dev
# Transform worker (polls 'transform' queue)
pnpm --filter @dxta/worker-transform dev
# Orchestrator (creates schedules, exposes health endpoint)
pnpm --filter @dxta/orchestrator dev

5. Trigger workflows manually

# Start extract workflow
pnpm --filter @dxta/orchestrator start:extract
# Start transform workflow
pnpm --filter @dxta/orchestrator start:transform

Architecture

┌─────────────────┐ ┌──────────────────────────────────────┐
│ Orchestrator │────▶│ Temporal Server │
│ (schedules + │ │ localhost:7233 │
│ CLI triggers) │ └──────────────┬───────────────────────┘
└─────────────────┘ │
▼
┌──────────────────┴──────────────────┐
│ │
┌───────▼───────┐ ┌─────────▼─────────┐
│ worker-extract│ │ worker-transform │
│ (queue:extract)│ │ (queue:transform) │
└───────┬───────┘ └─────────┬─────────┘
│ │
▼ ▼
┌───────────────┐ ┌─────────────────┐
│ GitHub API │ │ Databases │
│ + Databases │ │ │
└───────────────┘ └─────────────────┘

Project Structure

apps/
orchestrator/ # Schedule management and CLI commands
worker-extract/ # Extract pipeline worker (17 activities)
worker-transform/ # Transform pipeline worker (2 activities)
workflows/ # Temporal workflow definitions
stack/ # Legacy SST/AWS infra (deprecated)
packages/
config/ # Shared configuration
functions/ # Business logic (extract, transform, crawl)
integrations/ # External service clients (source-control)
schemas/ # Database schemas (Drizzle)

Commands

CommandDescription
pnpm installInstall all dependencies
pnpm run buildBuild all packages
pnpm run devStart all apps in dev mode (parallel)
pnpm run type-checkType-check all packages
pnpm run lintLint with Biome
pnpm run lint:fixAuto-fix lint issues
pnpm run formatFormat with Biome
pnpm run testRun all tests
pnpm run db:generateGenerate database migrations

Single package commands

pnpm --filter @dxta/worker-extract dev
pnpm --filter @dxta/transform-functions test
pnpm --filter ./apps/orchestrator type-check

Run a single test

pnpm --filter @dxta/transform-functions test -- --runTestsByPath src/parse-hunks.test.ts
pnpm --filter @dxta/transform-functions test -- -t "parse hunks"

Workflows

Extract pipeline:

  • extractTenantsWorkflow - Entry point, fans out to repositories
  • extractRepositoryWorkflow - Per-repo extraction
  • extractMergeRequestWorkflow - Per-MR extraction

Transform pipeline:

  • transformTenantsWorkflow - Entry point, fans out to repositories
  • transformRepositoryWorkflow - Per-repo transformation

Scheduling

When the orchestrator starts, it creates Temporal schedules:

  • Extract: Every 15 minutes at minute 8 (:08, :23, :38, :53)
  • Transform: Every 15 minutes on the quarter-hour (:00, :15, :30, :45)

Database Migrations

The project uses Drizzle Kit to generate SQL migrations. There are two migration targets:

SchemaPurposeOutput
@dxta/combined-schemaAll per-tenant tablesmigrations/combined/
@dxta/super-schemaCentral tenant registry (deprecated)migrations/super/

Generate migrations

# Generate all migrations
pnpm run db:generate
# Generate combined migrations only
pnpm --filter @dxta/combined-schema db:generate
# Generate super migrations only (deprecated)
pnpm --filter @dxta/super-schema db:generate

The combined-schema aggregates tables from extract-schema, transform-schema, tenant-schema, and crawl-schema. When you modify any of these base schemas, regenerate combined migrations.

Scripts

Seed Schema

Seeds dimension tables (dates, times, forge users) in a tenant database.

pnpm tsx scripts/seed-schema.mts -u "<DATABASE_URL>" -t "<AUTH_TOKEN>"

Arguments:

  • -u, --url (required): LibSQL database URL
  • -t, --authToken (optional): Database auth token

The script seeds data for a 10-year range (5 years before and after the current date).

About

DEV EXPERIENCE | TEMPO | ALIGNMENT

Resources

Stars

3 stars

Watchers

2 watching

Forks

Releases

Packages

Used by

Contributors

Languages