1import type { NextConfig } from 'next';23const nextConfig: NextConfig = {4 reactStrictMode: true,5 poweredByHeader: false,6 // Workspace packages are consumed as TypeScript sources.7 transpilePackages: ['@rareindex/shared', '@rareindex/database', '@rareindex/taxonomy', '@rareindex/connectors', '@rareindex/ai'],8 serverExternalPackages: ['postgres', 'pino', 'cheerio', 'pg-boss', '@anthropic-ai/sdk', 'openai'],9 // Public API: /api/v1/* is proxied to the Fastify service (apps/api) so one public host serves web + API.10 async rewrites() {11 const api = process.env.RI_API_URL ?? `http://127.0.0.1:${process.env.API_PORT ?? 8211}`;12 return [{ source: '/api/v1/:path*', destination: `${api}/v1/:path*` }];13 },14 images: {15 remotePatterns: [{ protocol: 'https', hostname: '**' }],16 formats: ['image/avif', 'image/webp'],17 },18 experimental: {19 optimizePackageImports: ['lucide-react'],20 },21 async headers() {22 return [23 {24 source: '/(.*)',25 headers: [26 { key: 'X-Content-Type-Options', value: 'nosniff' },27 { key: 'Referrer-Policy', value: 'strict-origin-when-cross-origin' },28 { key: 'X-Frame-Options', value: 'SAMEORIGIN' },29 { key: 'Permissions-Policy', value: 'camera=(self), microphone=(), geolocation=()' },30 ],31 },32 ];33 },34};3536export default nextConfig;37