/** @type {import('next').NextConfig} */ // All /api/* requests from the browser are transparently proxied to the // FastAPI process on 127.0.0.1:8000. Only port 7860 is exposed by the HF Space. const nextConfig = { reactStrictMode: true, output: "standalone" === process.env.NEXT_OUTPUT ? "standalone" : undefined, // Allow large PDF uploads through the upload route handler experimental: { serverActions: { bodySizeLimit: "100mb" }, proxyClientMaxBodySize: "100mb", }, async rewrites() { const backend = process.env.BACKEND_INTERNAL_URL || `http://127.0.0.1:${process.env.BACKEND_PORT || "8000"}`; return [ { source: "/api/:path*", destination: `${backend}/:path*`, }, ]; }, }; module.exports = nextConfig;