import type { NextConfig } from "next"; const apiUrl = process.env.API_URL ?? "http://127.0.0.1:8221"; const nextConfig: NextConfig = { reactStrictMode: true, agentRules: false, poweredByHeader: false, transpilePackages: ["@fetcha/core", "@fetcha/db", "@fetcha/email", "@fetcha/providers"], serverExternalPackages: ["pg", "undici", "resend"], async rewrites() { // Public API is served on the same domain under /v1/* and forwarded to the Fastify service. return [ { source: "/v1/:path*", destination: `${apiUrl}/v1/:path*` }, { source: "/api/health", destination: `${apiUrl}/health` }, { source: "/api/ready", destination: `${apiUrl}/ready` }, ]; }, async headers() { return [ { source: "/(.*)", headers: [ { key: "X-Content-Type-Options", value: "nosniff" }, { key: "X-Frame-Options", value: "DENY" }, { key: "Referrer-Policy", value: "strict-origin-when-cross-origin" }, { key: "Permissions-Policy", value: "camera=(), microphone=(), geolocation=()" }, ], }, ]; }, }; export default nextConfig;