AI-assisted recipe discovery app: React (Vite + TypeScript) frontend and a small Node API that proxies Spoonacular and optional Google Gemini calls so secrets stay off the client.
- Node.js 20+ (CI uses 22)
- Spoonacular API key
- Optional: Google AI Studio Gemini API key for recipe copilot and natural-language search
-
Set
SPOONACULAR_API_KEYin either the repo root.envorapps/api/.env(see.env.example). The API loads both;apps/api/.envwins if a variable is set in both. A rootREACT_APP_API_KEYfrom the old CRA setup is still accepted as the Spoonacular key. AddGEMINI_API_KEYif you want AI features (optionalGEMINI_MODEL, defaultgemini-3-flash-preview— use the exact model id from Google AI Studio if you see 404 ongenerateContent). If Gemini returns fetch failed, check VPN/firewall/proxy orHTTPS_PROXY. -
Install and run API + web together:
npm install
npm run dev- Web: http://localhost:5173 (Vite proxies
/apito the API in dev) - API: http://localhost:8787
- Production-style web pointing at a remote API:
# apps/web/.env.production
VITE_API_BASE_URL=https://your-api-host.example.comnpm run build -w @delectable/webServe apps/web/dist from any static host; ensure ALLOWED_ORIGINS on the API includes that host.
| Script | Description |
|---|---|
npm run dev |
API + Vite dev servers (concurrently) |
npm run build |
Build API (dist/) then web (dist/) |
npm run test |
Vitest (web) |
npm run lint |
ESLint (web + api) |
npm run typecheck |
TypeScript --noEmit (both packages) |
apps/web: feature-based UI, TanStack Query, Zod-validated API responses, DOMPurify for recipe HTML, lazy-loaded routes.apps/api: Hono server —/api/recipes/*,/api/ai/recipe-assist,/api/ai/search-parse(Gemini), CORS, simple rate limits on AI routes.
Legacy Create React App sources under the repo root have been superseded by apps/web; use the workspace commands above.
Node does not use the Windows system proxy for outbound fetch by default. If the browser works but the API cannot reach api.spoonacular.com or Google, set HTTPS_PROXY (and NO_PROXY=localhost,127.0.0.1) in apps/api/.env or the repo root .env, then restart npm run dev. The API also retries transient DNS errors a few times.
Private / portfolio use — adjust as needed.