#2102·SurfSense

[idea] Docker 02/14: VITE_API_BASE fallback in the frontend

Author: AnishSarkar22Created Oct 1, 2026Updated Oct 1, 2026
Labelsenhancementhelp wantedgood first issuefrontenddocker

Which part? Desktop app

What would you like?

Step 2 of 14 of #2100: running SurfSense in Docker. Depends on #2101; start once it is merged.

Let a browser build of the frontend reach the API under a path prefix, since there is no Electron bridge to give it the API URL.

Design: Docker proposal, The frontend without Electron

What to change

  • surfsense_local/frontend/src/lib/api.ts: the base becomes window.surfsense?.apiUrl ?? import.meta.env.VITE_API_BASE ?? "".
  • Type VITE_API_BASE in the Vite env types.

Done when

  • A build with VITE_API_BASE=/api sends requests to /api/..., including <img>, <audio> and download links built with apiUrl().
  • The desktop build and pnpm dev are unchanged.
  • pnpm test:unit passes, with a test for the fallback order.

Scope: code and tests only. Don't edit docs/ or AGENTS.md, except to fix a link this change breaks; the maintainers update the docs when the Docker work ships.

Why would it help?

Each step leaves something that runs, so the Docker image is built and reviewed one piece at a time.