Skip to main content

Web app & API proxies

The marketing and authenticated web UI are served by Next.js. Browser code calls same-origin paths like /api/backend/… and /api/autonomy/…. At build/runtime, Next.js rewrites those requests to your backends—no secrets or proprietary logic are embedded in the client bundle for routing.

Note

This page describes the public wiring pattern in this repository. Adjust hostnames and ports to match your deployment; the path shapes stay the same.

Rewrite rules (summary)

  • /api/backend/:path*→ FastAPI /api/v1/:path* (general API v1 surface).
  • /api/autonomy/:path*→ FastAPI /api/v1/autonomy/:path* (automation endpoints that some UI code calls with the shorter prefix).
  • /auth/*→ auth service (OAuth and related routes).

Shared client helpers that target /api/backend/autonomy/… use the first rule; legacy or shorthand paths use the second. Both land on the same FastAPI autonomy prefix.

Environment variables

The FastAPI base URL for rewrites comes from (in order) API_INTERNAL_URL, then NEXT_PUBLIC_API_URL, then http://localhost:8000. The auth base URL is AUTH_INTERNAL_URL or http://localhost:3001.

In Docker Compose, set API_INTERNAL_URL=http://api:8000 (service name + port) so the web container reaches the API on the internal network. For login flows, set AUTH_INTERNAL_URL when the auth service runs as a separate container.

Full tables: Environment variables · Self-hosted deployment

Quick verification

From a machine that can reach the API directly (replace host/port):

bash
curl -sS http://localhost:8000/health
curl -sS http://localhost:8000/openapi.json | head -c 200

Through the web app (same origin as the browser), after you are logged in if required:

bash
# Example: hits rewrite → FastAPI /api/v1/autonomy/...
curl -sS -o /dev/null -w "%{http_code}" https://your-web-host/api/autonomy/smart-gates

When the UI shows "Preview / demo"

Some authenticated pages still call endpoints that may not exist on your build of the API, or return errors until you wire features. Those screens show a visible preview banner and link to API overview and App vs autonomy API so expectations stay clear—without exposing implementation details beyond what is in the open repo.

API overview · OpenAPI & interactive docs · Autonomy UI routes