tfrere/research-article-template-editor
3
1# =============================================================================2# Research Article Template Editor - Backend environment variables3# =============================================================================4# Copy this file to backend/.env and fill in the values you need.5# All variables are optional unless stated otherwise.6# See docs/SPECIFICATION.md §6.3 for the full reference.7 8# -----------------------------------------------------------------------------9# Server10# -----------------------------------------------------------------------------11 12# HTTP listen port. Defaults to 8080.13# PORT=808014 15# Where documents, uploads and published bundles are stored on disk.16# Defaults to ./data (relative to the backend cwd).17# DATA_DIR=./data18 19# Toggle Playwright-based PDF + thumbnail generation. Set to "false" to disable20# PDF export (useful in environments without a browser).21# ENABLE_PDF=true22 23# -----------------------------------------------------------------------------24# Hugging Face OAuth (login + write-access check)25# -----------------------------------------------------------------------------26# Required to enforce auth on the editor. When OAUTH_CLIENT_ID and27# OAUTH_CLIENT_SECRET are unset, OAuth is disabled and every visitor can edit28# (useful for local dev).29#30# Create an OAuth app at https://huggingface.co/settings/connected-applications31# and set the redirect URI to:32# - http://localhost:8080/auth/callback (local dev)33# - https://<SPACE_HOST>/auth/callback (HF Space)34 35OAUTH_CLIENT_ID=36OAUTH_CLIENT_SECRET=37 38# Space-scoped OAuth needs:39# - "manage-repos" to read/write the dataset that backs persistence40# - "inference-api" so the user's OAuth token can call HF Inference41# Providers (powers the chat panel + embed studio)42# Defaults to "openid profile" when unset, which is enough for login-only43# flows but disables AI features and dataset persistence.44# OAUTH_SCOPES=openid profile manage-repos inference-api45 46# -----------------------------------------------------------------------------47# HF Space context (auto-injected by HF Spaces, set manually for local dev)48# -----------------------------------------------------------------------------49 50# Identifies the Space (e.g. "tfrere/research-article-template-editor").51# Auto-set by HF Spaces. Drives the default dataset id and enables OAuth +52# secure cookies in production. Leave empty for local dev.53# SPACE_ID=54 55# HTTPS host of the deployed Space (e.g. "tfrere-research-article-template-editor.hf.space").56# Auto-set by HF Spaces. Used to build the OAuth redirect URI.57# SPACE_HOST=58 59# -----------------------------------------------------------------------------60# Hugging Face dataset persistence61# -----------------------------------------------------------------------------62# Documents (.yjs), uploads and published bundles are pushed to a HF dataset so63# they survive Space restarts.64 65# Override the dataset id. Defaults to "${SPACE_ID}-data" when SPACE_ID is set.66# Example: HF_DATASET_ID=tfrere/research-article-template-editor-data67# HF_DATASET_ID=68 69# Server-side fallback HF token. Used when no user OAuth token is present yet70# (e.g. before the first login, or during local dev without OAuth).71#72# The chat panel and embed studio call Hugging Face Inference Providers73# (https://router.huggingface.co/v1) with this token when no OAuth token is74# available. Generate one at https://huggingface.co/settings/tokens with75# "Write" scope (or a fine-grained token with both repo + inference76# permissions). Optional on a HF Space with OAuth configured - the logged-in77# user's token is used instead.78# HF_TOKEN=79 80# -----------------------------------------------------------------------------81# AI features (chat panel + embed studio)82# -----------------------------------------------------------------------------83# The AI assistant calls Hugging Face Inference Providers with either the84# logged-in user's OAuth token or HF_TOKEN above. No extra API key needed -85# this is the whole point of moving off OpenRouter.86 87# Override the default model id used by the chat agent. The list of88# supported models is in backend/src/agent/chat.ts (AVAILABLE_MODELS), but89# any model exposed by HF Inference Providers with tool-calling support90# works. Defaults to "openai/gpt-oss-120b".91# You can also pin a specific provider by appending ":<provider>" to the92# model id, e.g. "meta-llama/Llama-3.3-70B-Instruct:together" - useful93# to avoid providers (such as Groq or Nscale) that reject the editor's94# wide tool registry with "Failed to call a function" or95# "tools parameter not supported".96# HF_INFERENCE_MODEL=openai/gpt-oss-120b97 98# -----------------------------------------------------------------------------99# Publishing100# -----------------------------------------------------------------------------101 102# Absolute base URL injected into the published HTML (canonical URL,103# OpenGraph, etc.). Defaults to http://127.0.0.1:${PORT}.104# Example: PUBLISH_BASE_URL=https://tfrere-research-article-template-editor.hf.space105# PUBLISH_BASE_URL=106 