/** * Global API Configuration * Centralizes API endpoint configuration for consistent routing across all services */ import { z } from 'zod'; // API Version Configuration export const API_CONFIG = { VERSION: 'v1', BASE_PATH: `/api/v1`, } as const; // Environment-specific API base URL const isProduction = import.meta.env.PROD; export const API_BASE_URL = import.meta.env.VITE_API_BASE_URL || (isProduction ? 'https://api.bugulma.city' : ''); // Full API base URL with version export const API_FULL_BASE_URL = `${API_BASE_URL}${API_CONFIG.BASE_PATH}`; // Service endpoint paths (relative to API version) export const API_ENDPOINTS = { ORGANIZATIONS: '/organizations', SITES: '/sites', MATCHING: '/matching', ANALYTICS: '/analytics', HERITAGE: '/heritage', AI: '/ai', PROPOSALS: '/proposals', AUTH: '/auth', } as const; // Development-time configuration validation (simplified) if (import.meta.env.DEV) { // Basic validation without complex Zod schemas // In development, API_BASE_URL can be empty string (uses relative URLs) if (typeof API_BASE_URL !== 'string') { console.error('🚨 API_BASE_URL is not properly configured'); } if (!API_CONFIG.VERSION || typeof API_CONFIG.VERSION !== 'string') { console.error('🚨 API version is not properly configured'); } }