const envApiBase = (import.meta as any).env?.PUBLIC_API_BASE || (import.meta as any).env?.API_BASE || ((globalThis as any).process?.env?.PUBLIC_API_BASE || (globalThis as any).process?.env?.API_BASE); export const API_BASE = envApiBase || ''; const serverEnvApiBase = (globalThis as any).process?.env?.INTERNAL_API_BASE || (globalThis as any).process?.env?.PUBLIC_API_BASE || (globalThis as any).process?.env?.API_BASE; export const SERVER_API_BASE = serverEnvApiBase || API_BASE; export interface HealthResponse { status: string; version: string; } export interface Community { id: string; name: string; slug: string; description: string | null; created_at: string; } export interface User { id: string; username: string; email: string; display_name: string | null; created_at: string; } export async function getHealth(): Promise { const res = await fetch(`${API_BASE}/health`); return res.json(); } export async function getCommunities(): Promise { const res = await fetch(`${API_BASE}/api/communities`); return res.json(); } export async function getUsers(): Promise { const res = await fetch(`${API_BASE}/api/users`); return res.json(); }