Monorepo Structure
TrenchTools uses a pnpm workspace with Turbo for build orchestration.
Workspace Layout
TrenchTools-OS/
├── packages/
│ ├── core/ # @trenchtools/core — TypeScript library
│ ├── ui/ # @trenchtools/ui — React dashboard (main app)
│ ├── docs/ # @trenchtools/docs — This documentation site
│ ├── landing/ # Landing page (trenchtools.io)
│ ├── bot/ # Bot package
│ ├── bot-telegram/ # Telegram bot integration
│ ├── cli/ # CLI tool
│ └── snipe/ # Standalone sniper package
├── package.json # Workspace root
├── pnpm-workspace.yaml # Workspace definition
├── turbo.json # Build pipeline config
└── tsconfig.json # Root TypeScript configBuild Pipeline
bash
# Build everything
pnpm build # → turbo run build
# Build specific package
npx turbo run build --filter=@trenchtools/ui --force
# Development
pnpm start # → pnpm --filter @trenchtools/ui dev
pnpm dev # → turbo run dev (all packages)Build Order
Turbo handles dependency ordering:
@trenchtools/corebuilds first (tsup)@trenchtools/uibuilds second (depends on core, uses tsc + vite)- Other packages build in parallel where possible
Core Package
Build tool: tsup (TypeScript bundler)
packages/core/src/
├── wallet/ # Keypair generation, encryption
├── snipe/ # Sniping logic (Raydium, PumpFun)
├── sniper-guard/ # Auto-sell engine
├── trading/ # Trade types and interfaces
├── pnl/ # P&L calculation
├── shield/ # Honeypot detection
├── detection/ # Manipulation detection (Allium)
├── activity/ # Activity generation
├── volume/ # Volume estimation, PumpSwap detection
├── treasury/ # Treasury management
├── orchestrator/ # Bot scheduling
├── browser/ # Browser-compatible crypto (Web Crypto API)
├── revenue/ # Fee management
├── supply/ # Token burning
├── liquidity/ # LP locking
└── logger.ts # Structured loggingExports (subpath exports in package.json):
@trenchtools/core → dist/index.js
@trenchtools/core/wallet → dist/wallet/index.js
@trenchtools/core/snipe → dist/snipe/index.js
@trenchtools/core/trading → dist/trading/index.js
@trenchtools/core/browser → dist/browser/index.jsUI Package
Build tool: tsc + vite
packages/ui/src/
├── components/ # React components (22+)
├── context/ # Context providers (6)
├── hooks/ # Custom hooks
├── lib/ # Libraries
│ ├── dex/ # DEX abstraction layer
│ └── browserWallet.ts
├── types/ # TypeScript type definitions
├── index.css # Global styles + Tailwind
└── main.tsx # App entry pointAdding a New Package
- Create
packages/new-package/with apackage.json - Set the name to
@trenchtools/new-package - Add build/dev scripts
- It's automatically included via
pnpm-workspace.yaml(packages/*glob) - Reference it from other packages:
"@trenchtools/new-package": "workspace:*"