This is a proof of concept demonstrating how to fetch client-side configuration via a fetch() call to an /api/client-config endpoint.
This strategy enables build-once-run-anywhere Next.js container images.
NEXT_PUBLIC_API_URL=https://reqres.in/api/users npm run devnpm run build
NEXT_PUBLIC_API_URL=https://reqres.in/api/users npm startYou can replace the API URL with any API that returns JSON data.
ex: NEXT_PUBLIC_API_URL=https://reqres.in/api/users/2