mirror of
https://gitee.com/wanwujie/deer-flow
synced 2026-04-28 16:24:47 +08:00
feat: add unified development environment with nginx proxy
Add a root-level Makefile to manage frontend, backend, and nginx services: - `make check` validates required dependencies (Node.js 22+, pnpm, uv, nginx) - `make install` installs all project dependencies - `make dev` starts all services with unified port 2026 - `make stop` and `make clean` for cleanup Update nginx configuration: - Change port from 8000 to 2026 - Add frontend upstream and routing (port 3000) - Add /api/langgraph/* routing with path rewriting to LangGraph server - Keep other /api/* routes to Gateway API - Route non-API requests to frontend Update frontend configuration: - Use relative URLs through nginx proxy by default - Support environment variables for direct backend access - Construct full URL for LangGraph SDK compatibility Clean up backend Makefile by removing nginx and serve targets. Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
This commit is contained in:
@@ -9,8 +9,11 @@
|
||||
# When adding additional environment variables, the schema in "/src/env.js"
|
||||
# should be updated accordingly.
|
||||
|
||||
# The base URL of DeerFlow's backend service
|
||||
NEXT_PUBLIC_BACKEND_BASE_URL="http://localhost:8000"
|
||||
# Backend API URLs (optional)
|
||||
# Leave these commented out to use the default nginx proxy (recommended for `make dev`)
|
||||
# Only set these if you need to connect to backend services directly
|
||||
# NEXT_PUBLIC_BACKEND_BASE_URL="http://localhost:8001"
|
||||
# NEXT_PUBLIC_LANGGRAPH_BASE_URL="http://localhost:2024"
|
||||
|
||||
# Better Auth
|
||||
## Better Auth - Google OAuth
|
||||
|
||||
@@ -4,7 +4,9 @@ export function getBackendBaseURL() {
|
||||
if (env.NEXT_PUBLIC_BACKEND_BASE_URL) {
|
||||
return env.NEXT_PUBLIC_BACKEND_BASE_URL;
|
||||
} else {
|
||||
return "http://localhost:8000";
|
||||
// Use empty string for same-origin requests through nginx
|
||||
// Paths like /api/models will be handled by nginx proxy
|
||||
return "";
|
||||
}
|
||||
}
|
||||
|
||||
@@ -12,6 +14,11 @@ export function getLangGraphBaseURL() {
|
||||
if (env.NEXT_PUBLIC_LANGGRAPH_BASE_URL) {
|
||||
return env.NEXT_PUBLIC_LANGGRAPH_BASE_URL;
|
||||
} else {
|
||||
return getBackendBaseURL();
|
||||
// LangGraph SDK requires a full URL, construct it from current origin
|
||||
if (typeof window !== "undefined") {
|
||||
return `${window.location.origin}/api/langgraph`;
|
||||
}
|
||||
// Fallback for SSR
|
||||
return "http://localhost:2026/api/langgraph";
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user