Configuration
Environment variables for the API, providers, retrieval, database, and browser origins.
The backend reads environment variables when modules load, so restart the API after editing .env. The browser's NEXT_PUBLIC_API_URL is inlined when the Next.js app is built; rebuild after changing it.
Copy .env.example to .env at the repository root. Never commit secrets.
Core services
| Variable | Purpose |
|---|---|
DATABASE_URL | PostgreSQL connection string. Local Docker exposes port 5433. |
NEO4J_URI | Neo4j Bolt connection. |
NEO4J_USERNAME | Neo4j login. |
NEO4J_PASSWORD | Neo4j password. |
FRONTEND_ORIGINS | Comma-separated browser origins accepted by CORS. |
Model providers
| Variable | Purpose |
|---|---|
LLM_PROVIDER | Chat-generation provider. |
LLM_MODEL | Chat model name. |
EMBEDDING_PROVIDER | Embedding provider, such as lmstudio or gemini. |
EMBEDDING_MODEL | Embedding model name. |
LMSTUDIO_URL | Base or fallback local model endpoint. |
LMSTUDIO_CHAT_URL | Local chat completion endpoint. |
LMSTUDIO_EMBEDDING_URL | Local embedding endpoint. |
GOOGLE_API_KEY | Credential used by Gemini embeddings. |
Separate chat and embedding endpoints where possible to avoid swapping a large local model between tasks.
Planner and retrieval
| Variable | Purpose |
|---|---|
PLANNER | keyword routes locally; llm enables model decomposition with fallback. |
CHAT_RETRIEVER | Retriever used by chat; defaults to hybrid_rr. |
RERANK_ENABLED | Set to 0 to skip cross-encoder reranking. |
RERANK_TOPN | Maximum fused candidates sent to the reranker; default 20. |
CHAT_MAX_TOKENS | Generation token limit for a chat response. |
PLAN_MAX_TOKENS | Token limit for an LLM-generated plan. |
Browser and optional guard
| Variable | Purpose |
|---|---|
NEXT_PUBLIC_API_URL | Public API origin used by the Next.js client; not a secret. |
DEMO_TOKEN | Optional shared token for selected administrative routes. |
When configured, the token is sent in the X-Demo-Token header. It does not add user sessions, per-user permissions, or protect every read endpoint.