import type { NextConfig } from "next"; /** * Staging config — proxies /api/* and /openapi.json to the production FastAPI * at legal-ai.nautilus.marcusgroup.org. This lets the new Next.js UI call the * existing backend without CORS and without running a second FastAPI instance. * * When the rewrite branch is cut over to production, set NEXT_PUBLIC_API_BASE_URL * and/or move the FastAPI in front of this app via traefik routing. */ const API_ORIGIN = process.env.NEXT_PUBLIC_API_ORIGIN ?? "https://legal-ai.nautilus.marcusgroup.org"; const nextConfig: NextConfig = { output: "standalone", async rewrites() { return [ { source: "/api/:path*", destination: `${API_ORIGIN}/api/:path*`, }, { source: "/openapi.json", destination: `${API_ORIGIN}/openapi.json`, }, ]; }, }; export default nextConfig;