export function getApiUrl() { if (typeof window !== 'undefined') return ''; // browser should use relative url if (process.env['BACKEND_URL']) return `https://${process.env['BACKEND_URL']}`; // SSR should use vercel url return `http://localhost:${process.env['PORT'] ?? 3000}`; // dev SSR should use localhost }