plover-env-and-backend

Diagnose env loading and backend URL wiring failures in the Plover Electron app.

1|Updated May 24, 2026
One-click install
npx skills add https://github.com/tryplover/Plover --skill plover-env-and-backend-tryplover
Or copy as Structured Prompt for Agent▼
Please help me install this Agent Skill.
Skill: plover-env-and-backend
Source: https://github.com/tryplover/Plover/tree/main/.claude/skills/plover-env-and-backend
Command: npx skills add https://github.com/tryplover/Plover --skill plover-env-and-backend-tryplover

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve? This Skill resolves recurring configuration footguns in the Plover Electron app: secrets from app/.env not reaching the main process, goal decomposition failing with 404 errors from port collisions, and PLOVER_BACKEND_URL being silently baked to the wrong value at Vite build time. ## Core Features & Use Cases - Env load ordering fix: Explains why process.loadEnvFile() must run in a dedicated first-import side-effect module (load-env.ts) so GOOGLE_CLIENT_ID is available before google-auth.ts evaluates. - Port collision diagnosis: Identifies when another local service occupies port 3000 and hijacks requests to the backend proxy, and how to move the backend to a different port. - Vite define correction: Shows how an always-truthy build-time default for import.meta.env.PLOVER_BACKEND_URL overrides the runtime app/.env value, and how defaulting to an empty string fixes it. - Use Case: You click "Continue with Google" in pnpm dev and the browser opens http://localhost:3000/signup with connection refused despite a correct Cloud Run URL in app/.env — this Skill pinpoints the Vite define as the root cause. ## Quick Start Ask the AI to diagnose why OAuth falls back to mock-client-id or why the signup flow opens localhost:3000 instead of the configured backend URL.

Frequently Asked Questions about plover-env-and-backend

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
Why is GOOGLE_CLIENT_ID from my .env file not picked up in Electron main process?▼

ES module imports are hoisted and evaluated before any statement in index.ts, so a body-level process.loadEnvFile() runs too late for modules that read process.env at evaluation time. Load env in a dedicated load-env.ts side-effect module imported first in index.ts.

How do I fix goal decomposition failing with "Server responded with status 404"?▼

The 404 occurs when another local service, such as a Next.js dev server, already occupies port 3000 and receives the requests meant for the backend proxy. Set PORT=3001 in server/.env and PLOVER_BACKEND_URL=http://localhost:3001 in app/.env, then restart both processes.

Why does import.meta.env.PLOVER_BACKEND_URL ignore my runtime .env value?▼

Vite's define bakes values at build time, and process.env.PLOVER_BACKEND_URL is unset then, so a fallback default gets baked in as always-truthy. Consumers check the Vite value first, so the runtime app/.env value never wins unless the build-time default is an empty string.

Does the Vite define fix break packaged production builds?▼

No. Packaged builds still work because CI sets PLOVER_BACKEND_URL in the release workflow environment before running pnpm package, so Vite bakes the real value there. The empty-string default only affects local dev where the runtime env file should win.

When should I read env vars lazily instead of at module evaluation time?▼

Read env vars lazily inside functions, like getGeminiClient() does, when the module may be imported before env loading completes. Module-evaluation-time reads require the env file to be loaded via a first-import side-effect module to guarantee ordering.