Skip to content

chore(env): document required env vars, remove unused Pexels integration #80

Description

@natashaannn

User story

As a developer setting up a new deployment, I want a complete .env.example that documents every env var the app actually uses, and I want unused integrations removed, so that configuration is straightforward and the codebase reflects current reality.

Background

Two problems:

  1. .env.example currently only documents PEXELS_API_KEY, but several env vars added by Issues feat(auth): add modular Resend subscriber email gate for carousel and get-youtube-captions #77 and feat(api): add secret token guard to internal filesystem-writing API routes #79 (RESEND_API_KEY, SUBSCRIBER_COOKIE_SECRET, etc.) need to be documented.
  2. The Pexels integration (scripts/fetch-pexels.js, scripts/lib/resolve-pexels.js) is unused and was gated behind PEXELS_API_KEY being set. It should be removed along with the env var.

Acceptance criteria

Happy path

Given this issue is merged
When a developer reads .env.example
Then every env var the app uses is documented with its purpose, whether it is required or optional, and which feature area it belongs to — and PEXELS_API_KEY is absent

Given this issue is merged
When a developer runs grep -r "pexels\|PEXELS" . --include="*.ts" --include="*.js" --include="*.tsx" (excluding node_modules)
Then zero results are returned

Edge case

Given a developer has PEXELS_API_KEY in their local .env.local
When they run edit-transcript.js after this issue is merged
Then no Pexels-related code runs (it has been removed) and no error occurs

Out of scope

  • Changing any non-Pexels application logic
  • Adding runtime env var validation beyond what already exists
  • Secret management tooling

Technical context

Files to DELETE:

  • scripts/fetch-pexels.js
  • scripts/lib/resolve-pexels.js

Files to EDIT:

  • scripts/edit-transcript.js — remove the PEXELS_API_KEY conditional block (~lines 2030–2036) and any import of resolve-pexels.js
  • package.json — remove the pexels:fetch script entry
  • .env.example — remove PEXELS_API_KEY; add all new env vars grouped by feature

Implementation details

1. Delete Pexels files

rm scripts/fetch-pexels.js
rm scripts/lib/resolve-pexels.js

2. Edit scripts/edit-transcript.js

Remove the conditional block starting at ~line 2030 that checks process.env.PEXELS_API_KEY and imports resolve-pexels.js. Confirm no other Pexels references remain in the file.

3. Edit package.json

Remove the "pexels:fetch" entry from the scripts block.

4. Rewrite .env.example with all current env vars, grouped by feature:

# ── Carousel tool ─────────────────────────────────────────────────────────────
# Required for AI-powered features
ANTHROPIC_API_KEY=
# Optional: defaults to claude-sonnet-4-20250514
# CLAUDE_MODEL=claude-sonnet-4-20250514

# ── Subscriber email gate ──────────────────────────────────────────────────────
# Required: Resend API credentials for subscriber enrolment and welcome emails
RESEND_API_KEY=
[email protected]
RESEND_SEGMENT_ID=
# Comma-separated topic IDs to subscribe new contacts to
RESEND_TOPICS=
# Min 32 characters — signs the subscriber session cookie
SUBSCRIBER_COOKIE_SECRET=

# ── Internal API guard (local/internal deployment only) ───────────────────────
# Required on internal instances: Bearer token for editor and camera save routes
INTERNAL_API_SECRET=

Additional test scenarios

  • grep -r "pexels\|PEXELS" scripts/ app/ remotion/ — zero results after merge
  • npm run dev starts without errors after removing PEXELS_API_KEY from local .env.local
  • package.json scripts block no longer contains pexels:fetch

Hard constraints

  • .env.example must never contain real secret values — only placeholder strings or comments
  • Variable names must exactly match what the code references (case-sensitive)
  • No other scripts/ or app/ behaviour should change beyond the Pexels removal

Dependency issues

Metadata

Metadata

Assignees

No one assigned

    Type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions