Production Setup: API Passthrough
mainThe quickest way to productionize is using the langgraph-nextjs-api-passthrough package to proxy requests and handle authentication.
Set the following environment variables:
NEXT_PUBLIC_ASSISTANT_ID: The ID of the assistant (client-side).LANGGRAPH_API_URL: The production deployment URL of your LangGraph server.NEXT_PUBLIC_API_URL: Your website URL +/api(e.g.,https://my-website.com/api).LANGSMITH_API_KEY: Your LangSmith API key (server-side secret, do NOT useNEXT_PUBLIC_prefix).
Example Configuration:
NEXT_PUBLIC_ASSISTANT_ID="agent"
LANGGRAPH_API_URL="https://my-agent.default.us.langgraph.app"
NEXT_PUBLIC_API_URL="https://my-website.com/api"
LANGSMITH_API_KEY="lsv2_..."NEXT_PUBLIC_ASSISTANT_ID="agent"
LANGGRAPH_API_URL="https://my-agent.default.us.langgraph.app"
NEXT_PUBLIC_API_URL="https://my-website.com/api"
LANGSMITH_API_KEY="lsv2_..."