Configuration & Environment Variables
Relevant source files
The following files were used as context for generating this wiki page:
ZINC-Fusion-V15 utilizes a distributed configuration strategy across its Python machine learning backend and Next.js frontend. The system relies heavily on environment variables to manage database connectivity, API authentication for external data providers (FRED, Anthropic, OpenAI), and operational constraints for the Inngest orchestration engine. Configuration is strictly segregated by environment boundaries, ensuring that frontend UI logic, data ingestion pipelines, and ML training workflows remain isolated.
The project enforces a "no hardcoded secrets" policy, requiring all sensitive values—including connection strings and service tokens—to be loaded from .env files or the system environment. This architecture supports high-precision soybean oil (ZL) procurement forecasting by allowing the system to scale across cloud-hosted Postgres instances and serverless execution environments without compromising security or data integrity.
Sources: README.md, CLAUDE.md, cubic.yaml
Infrastructure & Database Configuration
The system's authoritative source of truth is a cloud-hosted Prisma Postgres database. Configuration for this layer is primarily handled through the DATABASE_URL environment variable, which defines the connection string for the Prisma CLI, Python backend, and TypeScript frontend.
Database Connection and Concurrency
To prevent resource exhaustion in serverless environments, the project enforces strict concurrency limits on database operations. This is specifically configured for Inngest jobs using a plan ceiling.
The diagram above illustrates how environment variables drive connectivity across different tech stacks within the project.
| Configuration Variable | Default / Limit | Scope | Description |
|---|---|---|---|
DATABASE_URL | N/A (Required) | System | Primary connection string for Prisma Postgres. |
DB_CONCURRENCY | 5 | Inngest | Plan ceiling for simultaneous database connections. |
POSTGRES_URL | Fallback | Python | Secondary variable for PostgreSQL connection in scripts. |
Sources: README.md, AGENTS.md, cubic.yaml, scripts/generate_synthesis.py:102-105
AI & Machine Learning Configuration
The system integrates multiple Large Language Models (LLMs) for market synthesis and intelligence generation. Configuration for these services is centralized around model routing and token limits.
AI Model Routing
The project uses specific model constants to ensure consistent output quality for different analytical tasks. For instance, "Opus 4.5" is locked for comprehensive market synthesis, while other models may be used for per-card driver analysis.
| Service | Environment Variable | Usage |
|---|---|---|
| Anthropic | ANTHROPIC_API_KEY | Powers comprehensive market intelligence reports using Claude. |
| OpenAI | OPENAI_API_KEY | Used as a fallback for natural language synthesis if Anthropic is unavailable. |
Synthesis Engine Configuration
The synthesis engine, defined in scripts/generate_synthesis.py, uses configuration constants to manage the depth of generated briefings.
- Default Model:
claude-3-5-sonnet-20241022 - Max Tokens: 1500
- Horizon Support: [5, 21, 63, 126] days
Sources: frontend/src/lib/ai-intelligence.ts:10-30, scripts/generate_synthesis.py:53-58
Data Ingestion & API Tokens
ZINC-Fusion-V15 pulls data from a variety of external sources, each requiring specific authentication tokens configured via environment variables.
External Data Providers
The following table outlines the required tokens for the data pipeline:
| Data Source | Environment Variable | Component |
|---|---|---|
| FRED | FRED_API_KEY | Economic indicators (rates, inflation, labor). |
| ProFarmer | PROFARMER_USERNAME / PASSWORD | News and agricultural market sentiment scraping. |
| Fusion API | FUSION_API_TOKEN | Internal authentication for read-only database explorer endpoints. |
| CORS | FUSION_CORS_ORIGINS | Comma-separated list of allowed origins for the FastAPI server. |
Operational Security
The FastAPI server implements a _require_db_token dependency that validates the X-API-Token header against the FUSION_API_TOKEN environment variable. If the variable is not set, the server refuses to expose database explorer endpoints to prevent unauthorized access.
Sources: README.md, src/fusion/api/server.py:32-35, src/fusion/api/server.py:61-70, scripts/_deprecated/scrape_profarmer_deep_500plus.js:9-12
Orchestration & Job Configuration
Inngest handles the scheduling and orchestration of data pipelines. Its configuration is critical for maintaining project isolation, especially when sharing Vercel teams with other projects.
Inngest Client Configuration
The Inngest client must be explicitly configured with a unique ID to avoid cross-project contamination.
The sequence above shows the initialization process for the orchestration layer.
- Client ID:
fusion-jobs(Mandatory) - Concurrency Scope:
env(Ensures preview deployments do not steal production slots) - Signing Key:
WORKFLOW_INNGEST_SIGNING_KEY(Used for secure communication with the Inngest service)
Sources: cubic.yaml, README.md
Summary
Configuration in ZINC-Fusion-V15 is a strict multi-layer system designed for high-stakes commodity forecasting. It relies on a combination of global environment variables for infrastructure (DATABASE_URL), domain-specific keys for intelligence (ANTHROPIC_API_KEY, FRED_API_KEY), and rigid operational constants for job isolation (fusion-jobs ID). By segregating these variables across the Python and Next.js environments, the project maintains point-in-time data integrity and prevents resource exhaustion, ensuring accurate and secure ZL futures price predictions.