turash/bugulma/frontend/lib/api-config.ts
Damir Mukimov 6347f42e20
Consolidate repositories: Remove nested frontend .git and merge into main repository
- Remove nested git repository from bugulma/frontend/.git
- Add all frontend files to main repository tracking
- Convert from separate frontend/backend repos to unified monorepo
- Preserve all frontend code and development history as tracked files
- Eliminate nested repository complexity for simpler development workflow

This creates a proper monorepo structure with frontend and backend
coexisting in the same repository for easier development and deployment.
2025-11-25 06:02:57 +01:00

44 lines
1.3 KiB
TypeScript

/**
* 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');
}
}