/** @type {import('next').NextConfig} */ const API_BACKEND = process.env.API_BACKEND || (process.env.API_BACKEND_HOSTPORT ? `http://${process.env.API_BACKEND_HOSTPORT}` : "http://127.0.0.1:8000"); const nextConfig = { reactStrictMode: true, async rewrites() { // proxy /api/* to the FastAPI backend so the whole app is single-origin // (one public URL serves both frontend and API) return [{ source: "/api/:path*", destination: `${API_BACKEND}/api/:path*` }]; }, }; export default nextConfig;