diff --git a/frontend/.env.example b/frontend/.env.example new file mode 100644 index 0000000..c32c30c --- /dev/null +++ b/frontend/.env.example @@ -0,0 +1,12 @@ +# Frontend Environment Variables +# Copy this to .env.local for local development overrides + +# Backend API URL +# Production: Set in Vercel dashboard (e.g., https://codeintel-backend.railway.app) +# Development: Defaults to http://localhost:8000 (Docker Compose) +VITE_API_URL=http://localhost:8000 + +# Supabase Configuration +# Get these from your Supabase project settings +VITE_SUPABASE_URL=https://your-project.supabase.co +VITE_SUPABASE_ANON_KEY=your-anon-key-here diff --git a/frontend/src/components/Dashboard.tsx b/frontend/src/components/Dashboard.tsx index cb9e017..3dad836 100644 --- a/frontend/src/components/Dashboard.tsx +++ b/frontend/src/components/Dashboard.tsx @@ -12,8 +12,7 @@ import { ImpactAnalyzer } from './ImpactAnalyzer' import { PerformanceDashboard } from './PerformanceDashboard' import { UserNav } from './UserNav' import type { Repository } from '../types' - -const API_URL = 'http://localhost:8000' +import { API_URL } from '../config/api' type RepoTab = 'overview' | 'search' | 'dependencies' | 'insights' | 'impact' diff --git a/frontend/src/config/api.ts b/frontend/src/config/api.ts new file mode 100644 index 0000000..5e91bbc --- /dev/null +++ b/frontend/src/config/api.ts @@ -0,0 +1,13 @@ +/** + * API Configuration + * + * Centralizes API URL configuration for all frontend components. + * + * - Production: Set VITE_API_URL in Vercel dashboard to Railway backend URL + * - Development: Defaults to localhost:8000 (Docker Compose) + * - Local dev without Docker: Can override with .env.local + */ + +const API_URL = import.meta.env.VITE_API_URL || 'http://localhost:8000' + +export { API_URL }