Skip to content

Scripts Reference

This page documents all available scripts in the emp-job-queue monorepo. Scripts are organized by category and can be run using pnpm <script-name> or directly from the scripts/ directory.

Quick Start

Most commonly used scripts:

  • pnpm dev:local-redis - Start local development environment
  • pnpm dev:api - Start API server
  • pnpm dev:studio - Start EmProps Studio
  • pnpm build - Build all packages
  • pnpm test - Run all tests

Development Scripts

Local Development Environment

ScriptCommandDescription
Local Redis + APIpnpm dev:local-redisStarts fresh local Redis and API server with minimal logging
Stop Local Redispnpm dev:local-redis:stopStops local Redis server (brew services)
Full Stackpnpm dev:full-stackRuns API and Studio concurrently with color-coded output
Developer Setuppnpm setup:developerOne-command setup: install dependencies + start local Redis

Service Development

ScriptCommandDescription
APIpnpm dev:apiStart Job API server (port 3331)
EmProps APIpnpm dev:emprops-apiStart EmProps API server (port 3335)
Workerpnpm dev:workerStart worker service (Turbo)
Worker (Local)pnpm dev:worker:localStart worker with local configuration
Monitorpnpm dev:monitorStart monitoring UI (port 3002)
Webhookpnpm dev:webhookStart webhook service (port 3332)
Studiopnpm dev:studioStart EmProps Studio (port 3000)
Docspnpm dev:docsStart VitePress documentation site

Redis Development

ScriptCommandDescription
Dev Redispnpm dev:redisStart Redis with development configuration
Dev Datapnpm dev:redis:dev-dataStart Redis with dev data preloaded
Prod Clonepnpm dev:redis:prod-dataStart Redis with production data clone
Stop Redispnpm dev:redis:stopStop all Redis server instances
Sync Test DBpnpm redis:sync:testSync staging data to test environment (optimized)
Redis Migratepnpm redis:migrateRun Redis data migration scripts

Machine Development

ScriptCommandDescription
ComfyUI Devpnpm dev:machineStart ComfyUI machine in local-dev mode
ComfyUI Prodpnpm dev:machine:prodStart ComfyUI machine in local-prod mode
Simulation Devpnpm dev:machine:simStart simulation machine (local-dev)
Simulation Prodpnpm dev:machine:sim:prodStart simulation machine (local-prod)
Stop Machinepnpm dev:machine:downStop all dev machines
Machine Logspnpm dev:machine:logsFollow dev machine logs
Machine Execpnpm dev:machine:execExecute bash in ComfyUI dev container
Debug (2 Workers)pnpm dev:machine:debugStart ComfyUI with 2 workers for debugging

Build Scripts

Package Builds

ScriptCommandDescription
Build Allpnpm buildBuild all packages with Turbo
Build Prodpnpm build:prodBuild with CURRENT_ENV=production
Build Devpnpm build:devBuild with CURRENT_ENV=development
Build Backendpnpm build:backendBuild only backend services (core, api, webhook, emprops-api, telemetry)
Build Workerpnpm build:workerForce rebuild worker package
Build Worker Prodpnpm build:worker:prodBuild worker with production env
Build Studiopnpm build:studioBuild EmProps Studio
Bundle Workerpnpm worker:bundleCreate self-contained worker bundle with esbuild

Build Status

ScriptCommandDescription
Status Allpnpm build:statusCheck build status of all services
Status EmProps APIpnpm build:status:emprops-apiCheck EmProps API build status
Status Job APIpnpm build:status:apiCheck Job API build status
Status Workerpnpm build:status:workerCheck worker build status
Status Telemetrypnpm build:status:telemetryCheck telemetry collector build status
Build Infopnpm build:infoShow build metadata (human-readable)
Build Info JSONpnpm build:info:jsonShow build metadata (JSON format)
Build Info Currentpnpm build:info:currentShow current build information

Docker Scripts

Docker Build & Push

ScriptCommandDescription
Build Allpnpm d:all:buildBuild all Docker containers in parallel
Build All Sequentialpnpm d:all:build:sequentialBuild all containers sequentially
Build All (No Cache)pnpm d:all:build:nocacheBuild all containers without cache
Build & Push Allpnpm d:all:build:pushBuild and push all containers in parallel
Deploypnpm d:deployUnified deployment script

API Container

ScriptCommandDescription
Buildpnpm d:api:buildBuild API Docker image
Build (No Cache)pnpm d:api:build:nocacheBuild API without cache
Pushpnpm d:api:pushPush API image to registry
Build & Pushpnpm d:api:build:pushBuild and push API
Pullpnpm d:api:pullPull API image from registry
Runpnpm d:api:runRun API container locally
Pull & Runpnpm d:api:pull:runPull and run API container
Statuspnpm d:api:statusCheck API health endpoint
Generate Envpnpm d:api:env_genGenerate API environment file

EmProps API Container

ScriptCommandDescription
Buildpnpm d:emprops-api:buildBuild EmProps API Docker image
Build (No Cache)pnpm d:emprops-api:build:nocacheBuild without cache
Pushpnpm d:emprops-api:pushPush image to registry
Build & Pushpnpm d:emprops-api:build:pushBuild and push EmProps API
Pullpnpm d:emprops-api:pullPull image from registry
Runpnpm d:emprops-api:runRun EmProps API container
Pull & Runpnpm d:emprops-api:pull:runPull and run container
Statuspnpm d:emprops-api:statusCheck health endpoint
Generate Envpnpm d:emprops-api:env_genGenerate environment file

Webhook Service Container

ScriptCommandDescription
Buildpnpm d:webhook:buildBuild webhook service Docker image
Build (No Cache)pnpm d:webhook:build:nocacheBuild without cache
Pushpnpm d:webhook:pushPush image to registry
Build & Pushpnpm d:webhook:build:pushBuild and push webhook service
Pullpnpm d:webhook:pullPull image from registry
Runpnpm d:webhook:runRun webhook container
Pull & Runpnpm d:webhook:pull:runPull and run container
Statuspnpm d:webhook:statusCheck health endpoint
Generate Envpnpm d:webhook:env_genGenerate environment file

Telemetry Collector Container

ScriptCommandDescription
Buildpnpm d:telcollect:buildBuild telemetry collector image
Build (No Cache)pnpm d:telcollect:build:nocacheBuild without cache
Pushpnpm d:telcollect:pushPush image to registry
Build & Pushpnpm d:telcollect:build:pushBuild and push telemetry
Pullpnpm d:telcollect:pullPull image from registry
Runpnpm d:telcollect:runRun telemetry container
Pull & Runpnpm d:telcollect:pull:runPull and run container
Statuspnpm d:telcollect:statusCheck health endpoint
Generate Envpnpm d:telcollect:env_genGenerate environment file

Machine Container

ScriptCommandDescription
Uppnpm d:machine:upStart machine with docker-compose
Up & Buildpnpm d:machine:up:buildStart and build machine
Downpnpm d:machine:downStop machine containers
Buildpnpm d:machine:buildBuild machine image
Build (No Cache)pnpm d:machine:build:nocacheBuild without cache
Build & Pushpnpm d:machine:build:pushBuild and push machine
Build Localpnpm d:machine:build:localBuild for local testing
Pull & Runpnpm d:machine:pull:runPull and run machine
Logspnpm d:machine:logsView machine logs
Statuspnpm d:machine:statusCheck machine health endpoint
Generate Envpnpm d:machine:env_genGenerate machine environment file

Other Container Builds

ScriptCommandDescription
Databasepnpm d:database:buildBuild database package
Monitorpnpm d:monitor:buildBuild monitor package
Monitor Envpnpm d:monitor:env_genGenerate monitor environment
Studiopnpm d:emprops-studio:buildBuild EmProps Studio
Studio Envpnpm d:emprops-studio:env_genGenerate Studio environment
Env Diffpnpm d:env:diffCompare deployment environment files

Environment Management

Environment Builder

ScriptCommandDescription
Build Envpnpm env:build <profile>Build environment for profile (production, development, etc.)
Build Worker-Drivenpnpm env:build:worker-drivenBuild worker-driven environment configuration
Switch Envpnpm env:switchSwitch between environments interactively
Validate Envpnpm env:validateValidate environment configuration
List Profilespnpm env:list or pnpm profilesList all available environment profiles
Consolidatepnpm env:consolidateConsolidate environment variables
Show Envpnpm env:showShow current service environment variables

Profile Runner

ScriptCommandDescription
Run Profilepnpm run-profile <profile>Run a specific environment profile
Run Profile Debugpnpm run-profile:debug <profile>Run profile with debug mode enabled
Run Servicepnpm run-service <service>Run a specific service
Compose Profilepnpm compose:profileGenerate docker-compose from profile

Vercel Deployment

ScriptCommandDescription
Push to Vercelpnpm env:vercel:pushPush environment variables to Vercel
Export to Vercelpnpm env:vercel:exportExport environment to Vercel format
Delete from Vercelpnpm env:vercel:deleteDelete environment variables from Vercel

Testing Scripts

Unit & Integration Tests

ScriptCommandDescription
Test Allpnpm testRun all tests across monorepo
Test Corepnpm test:coreRun @emp/core package tests
Test Core UIpnpm test:core:uiRun core tests with Vitest UI
Test Core Watchpnpm test:core:watchRun core tests in watch mode
Test APIpnpm test:apiRun API server tests
Test API UIpnpm test:api:uiRun API tests with Vitest UI
Test API Watchpnpm test:api:watchRun API tests in watch mode
Test API Coveragepnpm test:api:coverageGenerate API test coverage report
Test Workerpnpm test:workerRun worker service tests
Test Worker UIpnpm test:worker:uiRun worker tests with Vitest UI
Test Worker Watchpnpm test:worker:watchRun worker tests in watch mode
Test Webhookpnpm test:webhookRun webhook service tests
Test Webhook UIpnpm test:webhook:uiRun webhook tests with Vitest UI
Test Webhook Watchpnpm test:webhook:watchRun webhook tests in watch mode
Test Telemetrypnpm test:telemetryRun telemetry collector tests
Test Telemetry UIpnpm test:telemetry:uiRun telemetry tests with UI
Test Monitorpnpm test:monitorRun monitor UI tests
Test Monitor UIpnpm test:monitor:uiRun monitor tests with UI
Test Machinepnpm test:machineRun machine tests
Test Studiopnpm test:studioRun EmProps Studio tests

E2E Tests

ScriptCommandDescription
API E2Epnpm test:api:e2eRun API end-to-end tests
API E2E UIpnpm test:api:e2e:uiRun API E2E tests with UI
API E2E Telemetrypnpm test:api:e2e:telemetryRun API E2E telemetry tests
Webhook E2Epnpm test:webhook:e2eRun webhook end-to-end tests
Webhook E2E UIpnpm test:webhook:e2e:uiRun webhook E2E with UI
Webhook E2E Telemetrypnpm test:webhook:e2e:telemetryRun webhook E2E telemetry tests
Telemetry E2Epnpm test:telemetry:e2eRun telemetry collector E2E tests
Infrastructure Testspnpm test:infrastructureRun infrastructure validation tests

Quality Assurance

ScriptCommandDescription
Lint Allpnpm lintRun ESLint across all packages
Lint Studiopnpm lint:studioRun ESLint for EmProps Studio
Typecheck Allpnpm typecheckRun TypeScript type checking on all packages
Typecheck Studiopnpm typecheck:studioRun TypeScript checking for Studio
Check Corepnpm check:coreVerify and rebuild @emp/core if needed

Utility Scripts

Logging & Monitoring

ScriptCommandDescription
Log Viewerpnpm logsInteractive log viewer for all services
EmProps API Logspnpm logs:emprops-apiTail EmProps API logs
Studio Logspnpm logs:emprops-studioTail EmProps Studio logs
Redis Monitorpnpm logs:redisFiltered Redis monitor output
All Logs Watchpnpm dev:all:logs:watchWatch all service logs
Error Logspnpm dev:all:logs:errorsFilter logs for errors only

Redis CLI

ScriptCommandDescription
Local Redis CLIpnpm redis-cli-localConnect to local Redis (host.docker.internal:6379)
Production Redis CLIpnpm redis-cli-prodConnect to production Redis
Redis Monitor./scripts/redis-monitor-filtered.shFiltered Redis monitor output
Clean Redis Start./scripts/redis-clean-start.shStart Redis with clean state

ngrok Tunneling

ScriptCommandDescription
ngrok Checkpnpm ngrok:checkCheck ngrok health (headless)
ngrok Startpnpm ngrok:startStart ngrok tunnels (headless)
ngrok Watchpnpm ngrok:watchWatch ngrok tunnel status
ngrok Statuspnpm ngrok:statusList active ngrok tunnels (JSON)
ngrok Stoppnpm ngrok:stopStop all ngrok processes
ngrok Allpnpm ngrokStart all ngrok tunnels from config
ngrok APIpnpm ngrok:apiStart ngrok tunnel for API only
ngrok EmPropspnpm ngrok:empropsStart ngrok tunnel for EmProps only
ngrok Redispnpm ngrok:redisStart ngrok tunnel for Redis only

Shutdown & Cleanup

ScriptCommandDescription
Shutdown Allpnpm shutdownStop all containers and cleanup
Shutdown Containerspnpm shutdown:containerStop Docker containers only
Stop Allpnpm dev:all:stop or pnpm stop-allStop all development services
Cleanpnpm cleanClean all build artifacts and node_modules
Clean Installpnpm install:cleanRemove node_modules, lockfile, and reinstall
Clean Turbo Cache./scripts/clean-turbo-cache.shClear Turbo build cache

Worktree Management

ScriptCommandDescription
Create Worktreepnpm worktree:createCreate new git worktree for parallel work
Setup Worktreepnpm worktree:setupSetup environment in worktree
Setup Worktree Env./scripts/worktree/setup-worktree-env.shCopy env files and build config for worktree

Database Scripts

ScriptCommandDescription
Schema Diffpnpm db:schema:diffCompare database schemas
Backup Prod Redis./scripts/backup-prod-redis.shBackup production Redis data

Dashboard Scripts

ScriptCommandDescription
Dev Dashboardpnpm dash:devOpen development dashboard in terminal
Staging Dashboardpnpm dash:stagingOpen staging dashboard in terminal
Restart Servicepnpm dash:dev:restartRestart a service from dashboard

Direct Script Files

The following scripts are located in the scripts/ directory and can be run directly:

Development Scripts

  • scripts/dev-local-redis.sh - Complete local dev environment setup
  • scripts/dev-redis.sh - Start Redis for development
  • scripts/dev-worker-local.sh - Start worker locally
  • scripts/dev-service.js - Generic service launcher

Environment Scripts

  • scripts/env/build-env.js - Environment builder (main entry point)
  • scripts/env/consolidate-env.js - Consolidate environment variables
  • scripts/env/validate-env.js - Validate environment configuration
  • scripts/env/list-profiles.js - List available profiles
  • scripts/env/profile-runner.js - Run environment profiles
  • scripts/env/service-runner.js - Run individual services
  • scripts/env/switch-env.js - Switch between environments

Docker Scripts

  • scripts/docker/build-all-containers.sh - Build all containers
  • scripts/docker/build-all-parallel.sh - Build all in parallel
  • scripts/docker/build-push-all-parallel.sh - Build and push all
  • scripts/run-api-docker.sh - Run API container
  • scripts/run-emprops-api-docker.sh - Run EmProps API container
  • scripts/run-webhook-docker.sh - Run webhook container
  • scripts/run-telcollect-docker.sh - Run telemetry container

Machine Scripts

  • scripts/env/machine-compose.js - Docker-compose manager for machines
  • scripts/env/machine-build.js - Build machine images
  • scripts/env/machine-local-build.sh - Build machine for local testing

Utility Scripts

  • scripts/log-viewer.js - Interactive log viewer
  • scripts/show-service-env.js - Display service environment
  • scripts/show-build-info.js - Show build metadata
  • scripts/generate-build-metadata.js - Generate build metadata
  • scripts/bundle-worker.sh - Create self-contained worker bundle
  • scripts/ngrok-health-check.js - ngrok tunnel management
  • scripts/terminal/restart-service.js - Service restart utility
  • scripts/terminal/dashboard-dev.sh - Development dashboard
  • scripts/terminal/dashboard-staging.sh - Staging dashboard

Testing Scripts

  • scripts/test-infrastructure.sh - Infrastructure validation
  • scripts/test-local-fluent-bit.sh - Test Fluent Bit locally

Redis Scripts

  • scripts/redis-clean-start.sh - Start fresh Redis instance
  • scripts/redis-migrate.sh - Run Redis migrations
  • scripts/redis-monitor-filtered.sh - Filtered Redis monitor
  • scripts/redis/sync-staging-to-test-optimized.sh - Optimized data sync
  • scripts/backup-prod-redis.sh - Backup production data

Worktree Scripts

  • scripts/worktree-create.sh - Create git worktree
  • scripts/setup-worktree.sh - Setup worktree environment
  • scripts/worktree/setup-worktree-env.sh - Copy env and build config

Common Workflows

Starting Local Development

bash
# Full local development setup
pnpm setup:developer

# Or step-by-step:
pnpm dev:local-redis          # Start Redis + API
pnpm dev:studio               # Start EmProps Studio
pnpm dev:monitor              # Start monitoring UI

Building for Production

bash
# Build all packages
pnpm build:prod

# Build and push all Docker containers
pnpm d:all:build:push

# Or build specific services
pnpm d:api:build:push
pnpm d:emprops-api:build:push
pnpm d:webhook:build:push
pnpm d:machine:build:push

Running Tests

bash
# Run all tests
pnpm test

# Run tests with UI for better debugging
pnpm test:core:ui
pnpm test:api:ui
pnpm test:worker:ui

# Run tests in watch mode during development
pnpm test:core:watch

Environment Management

bash
# List available profiles
pnpm env:list

# Build environment for production
pnpm env:build production

# Switch between environments
pnpm env:switch

# Validate current environment
pnpm env:validate

Docker Development

bash
# Start machine locally
pnpm d:machine:up:build

# View machine logs
pnpm d:machine:logs

# Stop machine
pnpm d:machine:down

# Check machine health
pnpm d:machine:status

Script Naming Conventions

  • dev:* - Development environment scripts
  • d:* - Docker-related scripts
  • env:* - Environment management scripts
  • test:* - Testing scripts
  • build:* - Build scripts
  • logs:* - Logging and monitoring scripts
  • ngrok:* - ngrok tunnel management
  • redis:* - Redis-specific scripts
  • worktree:* - Git worktree management

See Also

Released under the MIT License.