{"id":47622503,"url":"https://github.com/alrafiabdullah/doc_rag","last_synced_at":"2026-04-01T22:23:25.878Z","repository":{"id":344337782,"uuid":"1181424417","full_name":"alrafiabdullah/doc_rag","owner":"alrafiabdullah","description":"Document RAG with HuggingFace token without any storage.","archived":false,"fork":false,"pushed_at":"2026-03-14T08:35:41.000Z","size":166,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":0,"default_branch":"main","last_synced_at":"2026-03-14T17:18:27.612Z","etag":null,"topics":["caching","github-actions","huggingface-transformers","langchain-huggingface","rag","sentry-sdk"],"latest_commit_sha":null,"homepage":"https://rag.abdullahalrafi.com","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/alrafiabdullah.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null,"notice":null,"maintainers":null,"copyright":null,"agents":null,"dco":null,"cla":null}},"created_at":"2026-03-14T05:46:02.000Z","updated_at":"2026-03-14T09:21:11.000Z","dependencies_parsed_at":null,"dependency_job_id":null,"html_url":"https://github.com/alrafiabdullah/doc_rag","commit_stats":null,"previous_names":["alrafiabdullah/doc_rag"],"tags_count":null,"template":false,"template_full_name":null,"purl":"pkg:github/alrafiabdullah/doc_rag","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/alrafiabdullah%2Fdoc_rag","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/alrafiabdullah%2Fdoc_rag/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/alrafiabdullah%2Fdoc_rag/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/alrafiabdullah%2Fdoc_rag/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/alrafiabdullah","download_url":"https://codeload.github.com/alrafiabdullah/doc_rag/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/alrafiabdullah%2Fdoc_rag/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":31292639,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-04-01T21:15:39.731Z","status":"ssl_error","status_checked_at":"2026-04-01T21:15:34.046Z","response_time":53,"last_error":"SSL_read: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["caching","github-actions","huggingface-transformers","langchain-huggingface","rag","sentry-sdk"],"created_at":"2026-04-01T22:23:22.651Z","updated_at":"2026-04-01T22:23:25.847Z","avatar_url":"https://github.com/alrafiabdullah.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Document QA RAG (FastAPI + React + Notebook)\n\n##\n\n[![Scaffold CI](https://github.com/alrafiabdullah/doc_rag/actions/workflows/scaffold.yml/badge.svg)](https://github.com/alrafiabdullah/doc_rag/actions/workflows/scaffold.yml)\n\n##\n\nThis repository contains a complete Retrieval-Augmented Generation (RAG) workflow:\n- Backend API in `app/`\n- Frontend client in `front/`\n- Notebook prototype in `notebooks/`\n\nThe system accepts only `.txt` and `.pdf`, does not persist uploaded files, and supports streamed answers.\n\n## Repository Structure\n\n- `app/` FastAPI backend for RAG queries\n- `front/` React + Vite + TypeScript frontend\n- `notebooks/` Jupyter notebook prototype and local document workspace\n- `requirements.txt` Python dependencies for backend/notebook\n\n## Prerequisites\n\n- Python 3.10+\n- Node.js 24+ and Yarn\n- A Hugging Face token\n\n## 1) Clone and Install\n\n```bash\ngit clone \u003cyour-repo-url\u003e\ncd nlp_projects\npip install -r requirements.txt\ncd front\nyarn install\ncd ..\n```\n\n## 2) Run Backend (FastAPI)\n\n```bash\nuvicorn app.main:app --reload\n```\n\nBackend docs:\n- Swagger UI: http://localhost:8000/docs\n\n## 3) Run Frontend\n\n```bash\ncd front\nyarn dev\n```\n\nOpen the URL printed by Vite (typically http://localhost:5173).\n\n## 4) Use the App\n\n- Paste your Hugging Face token in the frontend (stored in browser localStorage)\n- Upload a `.txt` or `.pdf`\n- Enter a question (up to 1,000 characters)\n- Toggle stream on/off and submit\n\n## Environment Variables (Backend)\n\nOptional backend variables:\n- `CORS_ALLOWED_ORIGINS` (comma-separated)\n- `EMBEDDING_MODEL`\n- `LLM_MODEL`\n- `CHUNK_SIZE`\n- `CHUNK_OVERLAP`\n- `NUM_RETRIEVED_DOCS`\n- `HUGGINGFACE_API_KEY` (fallback token if frontend token is not provided)\n\n## Notes\n\n- Uploaded files are processed in-memory and are not stored by the API.\n- Frontend build check:\n```bash\ncd front\nyarn build\n```\n\n## Security for Public Repo\n\n- Never commit `.env` or real API keys.\n- Use `.env.example` as template and keep real values only in local env / deployment secret manager.\n- Frontend sends token using `Authorization: Bearer \u003ctoken\u003e` at request time.\n- If you suspect a token leak, rotate/revoke it immediately in Hugging Face settings.\n\nIf a secret was committed in git history, rewrite history before publishing:\n\n```bash\ngit filter-repo --path .env --invert-paths\ngit push --force --all\ngit push --force --tags\n```\n\n## Folder Docs\n\n- [app/README.md](app/README.md)\n- [front/README.md](front/README.md)\n- [notebooks/README.md](notebooks/README.md)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Falrafiabdullah%2Fdoc_rag","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Falrafiabdullah%2Fdoc_rag","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Falrafiabdullah%2Fdoc_rag/lists"}