sprout_etl
Fastify-based ETL service for data extraction, transformation, and loading.
Overview
The sprout_etl service handles:
- Ticketmaster event synchronization
- Skybox inventory management
- Event matching between platforms
- Price monitoring and comparison
- Automated purchase processing
Technology Stack
- Framework: Fastify 4.x
- Language: TypeScript 5.x
- Database: PostgreSQL with Prisma ORM
- Queue: BullMQ with Redis
- Search: MeiliSearch
- Monitoring: Prometheus, Sentry, OpenTelemetry
- Logging: Pino with Loki integration
Getting Started
Prerequisites
- Node.js 18+
- Bun (preferred) or npm
- Docker (for PostgreSQL and Redis)
- Doppler CLI (for environment variables)
Setup
-
Install dependencies:
bun install -
Start Docker services:
docker-compose up -d -
Run database migrations:
doppler run -- npx prisma migrate dev -
Start development server:
doppler run -- bun run start:dev -
Start background worker (separate terminal):
doppler run -- bun run worker:dev
Key Commands
See Detailed Commands Reference for complete command reference.
Development
bun run start:dev- Start ETL serverbun run worker:dev- Start background workerbun run build- Build TypeScript
CLI Commands
bun run cli:dev -- command-name [options]- Run CLI commands- See Commands Reference for full CLI reference
Code Quality
bun run type:check- Type checkingbun run lint- Lint with auto-fixbun run format- Format code
Testing
bun test- Run testsbun run test:cov- Coverage reportbun run test:e2e- E2E tests
Architecture
The service has three main entry points:
- Main HTTP Server (
src/main.ts) - Port 3001 - Background Worker (
src/worker.ts) - Background processing - CLI Interface (
src/cli/index.ts) - Command-line tools
Core Services
pipeline.service.ts- ETL pipeline orchestrationevent-processing.service.ts- Event data processingevent-pricing.service.ts- Price monitoringconsumer.service.ts- External API consumptioncron.service.ts- Scheduled tasks
Database
Uses Prisma ORM with PostgreSQL. Schema includes:
- Event runs (EventRun, EventRunItem)
- Inventory (SkyboxInventory, SkyboxSoldInventory)
- Monitoring (MonitoredListing, MonitoredListingPriceHistory)
Queue System
Uses BullMQ with Redis:
- ETL_QUEUE (concurrency: 5) - Data processing
- EVENT_MATCHER_QUEUE (concurrency: 1) - Event matching
API Endpoints
GET /health- Health checkGET /metrics- Prometheus metricsGET /api-docs- Swagger documentation- REST API endpoints for data processing
Environment Variables
All environment variables are in Doppler. See Environment Variables for complete list.
Key variables:
DATABASE_URL- PostgreSQL connectionREDIS_URL- Redis connectionMEILISEARCH_HOST- MeiliSearch URLTICKETMASTER_API_KEY- Ticketmaster API keyPLAYWRIGHT_SERVER_URL- Playwright server URL
Monitoring
- Metrics: Prometheus at
/metrics, Pushgateway for workers - Logging: Structured logging with Pino, Loki integration
- Tracing: OpenTelemetry integration
- Error Tracking: Sentry
Documentation
- Architecture Documentation
- CLAUDE.md - Developer guide
- CLI_COMMANDS.md - CLI reference
- Additional documentation:
Related Repositories
- sprout_backend - Main API service
- sprout_monitoring - Monitoring stack
- skybox_token_extractor - Token extraction service