/** @type {import('next').NextConfig} */ const nextConfig = { reactStrictMode: true, // Required for the standalone Docker output used in Hugging Face Spaces output: 'standalone', async rewrites() { // Use NEXT_PUBLIC_API_URL for HF Spaces / production, // fall back to localhost for local development const backendUrl = process.env.NEXT_PUBLIC_API_URL || 'http://127.0.0.1:8001'; return [ { source: '/api/:path*', destination: `${backendUrl}/:path*`, }, ]; }, }; module.exports = nextConfig;