Refactor API URLs and add environment config example

Replaces hardcoded production API URLs with localhost defaults for local development in both server and client code. Updates Dockerfile to require API URLs via deployment environment variables. Improves ChatTable to use a batch endpoint for chats and unread counts, with backward compatibility. Adds an env.example file to document required environment variables. Updates next.config.mjs to use environment variables for backend API rewrites and image domains.
This commit is contained in:
NotII
2025-09-01 15:35:10 +01:00
parent 3528ca45cc
commit 29ec1be68c
8 changed files with 74 additions and 29 deletions

23
env.example Normal file
View File

@@ -0,0 +1,23 @@
# Frontend Environment Configuration
# Copy this file to .env.local for development or .env for production
# ===========================================
# FRONTEND CONFIGURATION (Safe for browser)
# ===========================================
NEXT_PUBLIC_API_URL=/api
# ===========================================
# BACKEND CONFIGURATION (Server-side only)
# ===========================================
# Replace with your actual backend domain
SERVER_API_URL=https://internal-api.inboxi.ng/api
API_BASE_URL=https://internal-api.inboxi.ng
API_HOSTNAME=internal-api.inboxi.ng
# ===========================================
# DEVELOPMENT OVERRIDES
# ===========================================
# For local development, uncomment these:
# SERVER_API_URL=http://localhost:3001/api
# API_BASE_URL=http://localhost:3001
# API_HOSTNAME=localhost