Deployment & Infrastructure
Relevant source files
The following files were used as context for generating this wiki page:
The Recoup Tasks project infrastructure is built on Trigger.dev v4, providing a background worker architecture for executing long-running and scheduled integrations for the Recoup API. The system manages complex content creation pipelines, social media scraping, and AI agent sandboxes by offloading these processes to distributed background tasks.
The infrastructure leverages external AI services, specifically fal.ai for media generation and Vercel Sandboxes for isolated code execution. These components are orchestrated through a unified configuration that handles build-time asset bundling and runtime environment management.
Core Infrastructure Components
The infrastructure is categorized into three main layers: the Task Orchestration layer (Trigger.dev), the Computational layer (Vercel Sandboxes), and the External API layer (fal.ai and Recoup APIs).
Task Orchestration (Trigger.dev)
The system uses the Trigger.dev v4 SDK to define and manage background tasks. Configuration is centralized in trigger.config.ts, which specifies the project ID (proj_pxwxehzmqaxylqhhkomn), Node.js runtime, and machine resource profiles.
The diagram shows the relationship between local project configurations and the Trigger.dev cloud execution environment.
Sources: trigger.config.ts:4-10, README.md:1-5, AGENTS.md:17-25
Compute and Machine Profiles
Tasks are assigned specific machine profiles based on their resource requirements. While the default machine is set to "micro", intensive tasks like the content creation pipeline utilize "medium-1x" instances to handle media processing.
| Configuration | Value | Description |
|---|---|---|
| Project ID | proj_pxwxehzmqaxylqhhkomn | Unique identifier for the Trigger.dev project |
| Runtime | node | Execution environment |
| Default Machine | micro | Standard resource profile for light tasks |
| Max Duration | 3600s | Global timeout for task runs |
| Build Extensions | ffmpeg(), additionalFiles() | Bundles native binaries and static assets |
Sources: trigger.config.ts:4-21, src/tasks/createContentTask.ts:44-46
Build and Deployment Workflow
Deployment is handled via the Trigger.dev CLI. The infrastructure supports a distinct separation between development (local) and production environments.
Deployment Commands
The project uses pnpm for dependency management and task execution.
- Development:
pnpm devstarts the Trigger.dev development mode, allowing for local task execution and debugging. - Production:
pnpm run deploy:trigger-prod(aliased totrigger deploy) pushes the current task definitions and configurations to the Trigger.dev cloud.
Sources: package.json:2-5, README.md:12-23, AGENTS.md:12-15
Build-time Asset Bundling
The build process is enhanced using Trigger.dev build extensions. This ensures that non-code assets required by the content pipeline (such as JSON style guides and reference images) are included in the deployment bundle.
build: {
extensions: [
ffmpeg(),
additionalFiles({
files: [
"src/content/templates/**/*.json",
"src/content/templates/**/*.png",
"src/content/templates/**/*.jpg",
],
}),
],
}
Sources: trigger.config.ts:32-43
External Service Integrations
Vercel Sandbox Environments
The project utilizes Vercel Sandboxes to provide isolated Linux microVM environments. These are ephemeral environments used for executing AI agent tasks and running Claude Code.
- Isolation: Each sandbox runs in its own microVM.
- Persistence: Linked to GitHub repos for storage.
- Management: Created via
POST /api/sandboxeswith configurable timeouts.
Sources: src/sandboxes/writeReadme.ts:40-55, README.md:32-35
fal.ai Media Infrastructure
For media-heavy tasks, the infrastructure integrates with fal.ai. This service is used for image generation, upscaling (2x detail enhancement), and video animation (including lipsync paths). The createContentTask configures these credentials at runtime using the FAL_KEY environment variable.
The sequence shows how the infrastructure orchestrates external AI services to generate media assets.
Sources: src/tasks/createContentTask.ts:63-125, src/tasks/tests/createContentTask.test.ts:90-105
Environment Configuration
The infrastructure relies on specific environment variables for authentication and API access across different services.
| Variable | Description | Source |
|---|---|---|
FAL_KEY | Credentials for fal.ai media generation | createContentTask.ts |
GITHUB_TOKEN | Access for repo creation and sandbox auth | createOrgGithubRepo.ts |
CLAUDE_CODE_OAUTH_TOKEN | Authentication for Claude Code agent | runClaudeCodeAgent.ts |
Sources: src/tasks/createContentTask.ts:63-65, src/sandboxes/tests/runClaudeCodeAgent.test.ts:28, src/github/tests/createOrgGithubRepo.test.ts:16
Summary
Recoup Tasks infrastructure is a serverless worker system that combines Trigger.dev for orchestration, Vercel for isolated compute sandboxes, and fal.ai for specialized generative workloads. The deployment process is integrated into a Git-based workflow that enforces feature branching and automated PR creation via AI agents.