# ============================================================================= # Research Article Template Editor - Backend environment variables # ============================================================================= # Copy this file to backend/.env and fill in the values you need. # All variables are optional unless stated otherwise. # See docs/SPECIFICATION.md ยง6.3 for the full reference. # ----------------------------------------------------------------------------- # Server # ----------------------------------------------------------------------------- # HTTP listen port. Defaults to 8080. # PORT=8080 # Where documents, uploads and published bundles are stored on disk. # Defaults to ./data (relative to the backend cwd). # DATA_DIR=./data # Toggle Playwright-based PDF + thumbnail generation. Set to "false" to disable # PDF export (useful in environments without a browser). # ENABLE_PDF=true # ----------------------------------------------------------------------------- # Hugging Face OAuth (login + write-access check) # ----------------------------------------------------------------------------- # Required to enforce auth on the editor. When OAUTH_CLIENT_ID and # OAUTH_CLIENT_SECRET are unset, OAuth is disabled and every visitor can edit # (useful for local dev). # # Create an OAuth app at https://huggingface.co/settings/connected-applications # and set the redirect URI to: # - http://localhost:8080/auth/callback (local dev) # - https:///auth/callback (HF Space) OAUTH_CLIENT_ID= OAUTH_CLIENT_SECRET= # Space-scoped OAuth needs: # - "manage-repos" to read/write the dataset that backs persistence # - "inference-api" so the user's OAuth token can call HF Inference # Providers (powers the chat panel + embed studio) # Defaults to "openid profile" when unset, which is enough for login-only # flows but disables AI features and dataset persistence. # OAUTH_SCOPES=openid profile manage-repos inference-api # ----------------------------------------------------------------------------- # HF Space context (auto-injected by HF Spaces, set manually for local dev) # ----------------------------------------------------------------------------- # Identifies the Space (e.g. "tfrere/research-article-template-editor"). # Auto-set by HF Spaces. Drives the default dataset id and enables OAuth + # secure cookies in production. Leave empty for local dev. # SPACE_ID= # HTTPS host of the deployed Space (e.g. "tfrere-research-article-template-editor.hf.space"). # Auto-set by HF Spaces. Used to build the OAuth redirect URI. # SPACE_HOST= # ----------------------------------------------------------------------------- # Hugging Face dataset persistence # ----------------------------------------------------------------------------- # Documents (.yjs), uploads and published bundles are pushed to a HF dataset so # they survive Space restarts. # Override the dataset id. Defaults to "${SPACE_ID}-data" when SPACE_ID is set. # Example: HF_DATASET_ID=tfrere/research-article-template-editor-data # HF_DATASET_ID= # Server-side fallback HF token. Used when no user OAuth token is present yet # (e.g. before the first login, or during local dev without OAuth). # # The chat panel and embed studio call Hugging Face Inference Providers # (https://router.huggingface.co/v1) with this token when no OAuth token is # available. Generate one at https://huggingface.co/settings/tokens with # "Write" scope (or a fine-grained token with both repo + inference # permissions). Optional on a HF Space with OAuth configured - the logged-in # user's token is used instead. # HF_TOKEN= # ----------------------------------------------------------------------------- # AI features (chat panel + embed studio) # ----------------------------------------------------------------------------- # The AI assistant calls Hugging Face Inference Providers with either the # logged-in user's OAuth token or HF_TOKEN above. No extra API key needed - # this is the whole point of moving off OpenRouter. # Override the default model id used by the chat agent. The list of # supported models is in backend/src/agent/chat.ts (AVAILABLE_MODELS), but # any model exposed by HF Inference Providers with tool-calling support # works. Defaults to "openai/gpt-oss-120b". # You can also pin a specific provider by appending ":" to the # model id, e.g. "meta-llama/Llama-3.3-70B-Instruct:together" - useful # to avoid providers (such as Groq or Nscale) that reject the editor's # wide tool registry with "Failed to call a function" or # "tools parameter not supported". # HF_INFERENCE_MODEL=openai/gpt-oss-120b # ----------------------------------------------------------------------------- # Publishing # ----------------------------------------------------------------------------- # Absolute base URL injected into the published HTML (canonical URL, # OpenGraph, etc.). Defaults to http://127.0.0.1:${PORT}. # Example: PUBLISH_BASE_URL=https://tfrere-research-article-template-editor.hf.space # PUBLISH_BASE_URL=