Build infrastructure for Socket's binary artifacts and ML models.
Socket BTM is a monorepo containing build infrastructure for:
- Binary Tools - Custom C/C++ tools for binary manipulation
- Node.js - Custom Node.js binaries with Socket security patches
- WASM - ONNX Runtime and Yoga Layout WebAssembly builds
- ML Models - Quantized AI models for code analysis
Before building, ensure you have the required system dependencies installed:
- Build Tools: Xcode CLI Tools (macOS), GCC/Build Essential (Linux), Visual Studio Build Tools (Windows)
- Python 3.11+: For ML model building
- Node.js 18+: For build scripts and infrastructure
- pnpm: Package manager
See Prerequisites Guide for detailed platform-specific setup instructions.
# Install dependencies
pnpm install
# Build binary tools (required for Node.js builds)
cd packages/binject && make && cd ../..
cd packages/binpress && make && cd ../..
cd packages/binflate && make && cd ../..Core C/C++ tools for binary manipulation:
- binject - Binary resource injection for Mach-O, ELF, and PE
- binpress - Binary compression with platform-specific algorithms
- binflate - Binary decompression and self-extraction
- build-infra - Shared checkpoint system and build utilities
- Checkpoint Lifecycle - Visual guide to incremental builds
- Prerequisites - System dependencies and setup
- node-smol-builder - Custom Node.js v24.x with Socket patches
- 6 security and size-optimization patches
- SEA (Single Executable Application) support
- VFS (Virtual Filesystem) support
- Build Pipeline - Visual guide to build process
# Build Node.js
pnpm --filter node-smol-builder build
# Build for specific mode
pnpm --filter node-smol-builder build --dev # Development (faster JS, larger)
pnpm --filter node-smol-builder build --prod # Production (smaller, V8 Lite Mode)WebAssembly builds with checkpoint-based caching:
- onnxruntime-builder - ONNX Runtime with SIMD + threading
- yoga-layout-builder - Yoga Layout for flexbox
# Build WASM modules
pnpm --filter onnxruntime-builder build
pnpm --filter yoga-layout-builder buildQuantized AI models for code analysis:
- models - Unified ML model package
- minilm-builder - MiniLM-L6 sentence embeddings
- codet5-models-builder - CodeT5 code understanding
# Build all models (INT4 quantization, production)
pnpm --filter models build
# Development build (INT8, faster)
pnpm --filter models build --devAll builders use incremental checkpoints for fast rebuilds:
- Incremental Builds: Resume from last successful phase
- CI Caching: GitHub Actions cache integration
- Progressive Cleanup: Only keep latest checkpoint in CI (saves disk space)
- Backward Restoration: Walk backwards to find latest valid checkpoint
See Checkpoint Lifecycle for details.
Most packages support two build modes:
- dev: Fast JS, debug symbols, inspector enabled (~30-40 MB for Node.js)
- prod: V8 Lite Mode, stripped, compressed (~8-12 MB for Node.js)
Node.js binaries can be compressed with binpress:
- 50-70% size reduction
- Self-extracting with runtime decompression
- Cached in
~/.socket/_dlx/for fast subsequent runs - Platform-specific algorithms (LZFSE/LZMA/LZMS)
- Prerequisites - System dependencies and setup
- Checkpoint Lifecycle - Incremental build system
- Node.js Build Pipeline - Node.js build process
- binject README - Binary injection usage
- binpress README - Binary compression usage
- binflate README - Binary decompression usage
GitHub Actions workflows automatically build and cache artifacts:
.github/workflows/node-smol.yml- Node.js builds.github/workflows/models.yml- ML model builds.github/workflows/wasm.yml- WASM builds
Checkpoints are cached and restored using content-addressable keys.
MIT