--- title: RAGnarok Backend emoji: 💀 colorFrom: purple colorTo: red sdk: docker pinned: false app_port: 7860 --- # RAGnarok — FastAPI Backend This HuggingFace Space serves as the backend for the RAGnarok RAG application. ## Environment Variables (set in HF Space Settings → Variables) | Variable | Description | |---|---| | `SUPABASE_URL` | Your Supabase project URL | | `SUPABASE_ANON_KEY` | Supabase anon/public key | | `SUPABASE_JWT_SECRET` | JWT secret (Settings → API → JWT Settings) | | `ALLOWED_ORIGINS` | Your GitHub Pages URL, e.g. `https://username.github.io` | ## API Endpoints | Method | Path | Auth | Description | |---|---|---|---| | GET | `/health` | None | Health check | | POST | `/documents/upload` | JWT | Ingest a document | | GET | `/documents/` | JWT | List user's documents | | DELETE | `/documents/{id}` | JWT | Delete a document | | POST | `/chat/sessions` | JWT | Create chat session | | GET | `/chat/sessions` | JWT | List chat sessions | | GET | `/chat/sessions/{id}/messages` | JWT | Get messages | | POST | `/chat/sessions/{id}/messages` | JWT + X-LLM-Key | Stream RAG response | | DELETE | `/chat/sessions/{id}` | JWT | Delete session |