open-notebook/pyproject.toml
Luis Novo 9bdfd99f1b
feat: simplify reverse proxy configuration with Next.js rewrites (#213)
* feat: simplify reverse proxy configuration with Next.js rewrites

Add Next.js API rewrites to proxy /api/* requests internally from port 8502
to the FastAPI backend on port 5055. This eliminates the need for complex
reverse proxy configurations with multiple upstreams and location blocks.

Changes:
- Add rewrites to next.config.ts proxying /api/* to INTERNAL_API_URL
- Introduce INTERNAL_API_URL env var (defaults to http://localhost:5055)
- Update supervisord configs to pass INTERNAL_API_URL to Next.js
- Document INTERNAL_API_URL in .env.example with usage examples
- Add simplified reverse proxy examples for nginx, Traefik, Caddy, Coolify
- Update README architecture diagram to show internal proxying
- Add explanatory comments to _config route handler

Benefits:
- Reduces reverse proxy config from 12 lines to 3 (75% reduction)
- Single-port deployment (8502 only) for 95% of use cases
- Zero breaking changes - backward compatible with existing setups
- Zero performance overhead (validated through testing)
- Preserves proxy headers (X-Forwarded-*) for rate limiting/SSL

Resolves: #179
Related: OSS-321

* fix: rename _config to config to fix production routing

CRITICAL BUG FIX: The /_config endpoint has never worked in production builds
because Next.js treats folders starting with underscore as "private folders"
and excludes them from routing entirely.

This endpoint is critical for:
- Providing API_URL to the browser at runtime
- Enabling zero-config deployments with auto-detection
- Supporting reverse proxy scenarios where API URL differs from frontend URL

Changes:
- Rename frontend/src/app/_config/ → frontend/src/app/config/
- Update client code references (/_config → /config)
- Update documentation with correct endpoint path
- Bump version to 1.1.0 (minor version for new rewrites feature + bug fix)

Impact:
- Runtime configuration now works in production builds
- /config returns {"apiUrl":"http://localhost:5055"} correctly
- Auto-detection for reverse proxy deployments now functional

Related: #179, OSS-321

* fix: resolve React hook exhaustive-deps warning in AddExistingSourceDialog

Wrap performSearch function in useCallback to properly memoize it and satisfy
React Hook exhaustive-deps rule. This prevents unnecessary re-renders and
ensures the useEffect dependency array is correctly specified.

Changes:
- Import useCallback from React
- Wrap performSearch with useCallback([debouncedSearchQuery, allSources])
- Add performSearch to useEffect dependency array

* final fixes
2025-10-24 11:24:14 -03:00

99 lines
2.4 KiB
TOML

[project]
name = "open-notebook"
version = "1.1.0"
description = "An open source implementation of a research assistant, inspired by Google Notebook LM"
authors = [
{name = "Luis Novo", email = "lfnovo@gmail.com"}
]
readme = "README.md"
classifiers = [
"License :: OSI Approved :: MIT License",
"Programming Language :: Python :: 3",
"Programming Language :: Python :: 3.11",
]
requires-python = ">=3.11,<3.13"
dependencies = [
"fastapi>=0.104.0",
"uvicorn>=0.24.0",
"pydantic>=2.9.2",
"loguru>=0.7.2",
"langchain>=0.3.3",
"langgraph>=0.2.38",
"tiktoken>=0.8.0",
"langgraph-checkpoint-sqlite>=2.0.0",
"langchain-community>=0.3.3",
"langchain-openai>=0.2.3",
"langchain-anthropic>=0.2.3",
"langchain-ollama>=0.2.0",
"langchain-google-genai>=2.1.10",
"langchain-groq>=0.2.1",
"langchain_mistralai>=0.2.1",
"langchain_deepseek>=0.1.3",
"tomli>=2.0.2",
"groq>=0.12.0",
"python-dotenv>=1.0.1",
"httpx[socks]>=0.27.0",
"nest-asyncio>=1.6.0",
"content-core>=1.0.2",
"ai-prompter>=0.3",
"esperanto>=2.4.1",
"langchain-google-vertexai>=2.0.28",
"surrealdb>=1.0.4",
"surreal-commands>=1.0.13",
"podcast-creator>=0.7.0",
]
[tool.setuptools]
package-dir = {"open_notebook" = "open_notebook"}
[project.optional-dependencies]
dev = [
"ipykernel>=6.29.5",
"ruff>=0.5.5",
"mypy>=1.11.1",
"types-requests>=2.32.0.20241016",
"ipywidgets>=8.1.5",
"pre-commit>=4.0.1",
"pytest>=8.0.0",
]
[build-system]
requires = ["setuptools>=61.0"]
build-backend = "setuptools.build_meta"
[dependency-groups]
dev = [
"pre-commit>=4.1.0",
"pytest-asyncio>=1.2.0",
"types-requests>=2.32.4.20250913",
]
[tool.isort]
profile = "black"
line_length = 88
[tool.ruff]
line-length = 88
[tool.ruff.lint]
select = ["E", "F", "I"]
ignore = [
"E501", # line too long
"E402", # module level import not at top of file (Streamlit requires this pattern)
"E722", # do not use bare except (legacy code pattern)
"F401", # imported but unused (may be used in type hints or re-exports)
"F541", # f-string without placeholders
"F841", # local variable assigned but never used
]
[tool.ruff.lint.per-file-ignores]
# Streamlit files need nest_asyncio.apply() before imports
"app_home.py" = ["E402"]
"pages/**/*.py" = ["E402"]
[tool.mypy]
# Exclude Streamlit UI pages from type checking
[[tool.mypy.overrides]]
module = "pages.*"
ignore_errors = true