import { dirname, join } from 'node:path'; import { fileURLToPath } from 'node:url'; import type { NextConfig } from 'next'; const api = process.env.API_INTERNAL_URL ?? 'http://127.0.0.1:3001'; const nextConfig: NextConfig = { output: 'standalone', // Trace from the monorepo root so the workspace package @atm/shared is included. outputFileTracingRoot: join(dirname(fileURLToPath(import.meta.url)), '..'), transpilePackages: ['@atm/shared'], poweredByHeader: false, // In production Traefik routes /api directly to the API; the rewrite covers local development. async rewrites() { return [{ source: '/api/:path*', destination: `${api}/api/:path*` }]; }, async headers() { return [ { source: '/:path*', headers: [ { key: 'X-Content-Type-Options', value: 'nosniff' }, { key: 'Referrer-Policy', value: 'strict-origin-when-cross-origin' }, { key: 'X-Frame-Options', value: 'DENY' }, ], }, ]; }, }; export default nextConfig;