{"id":48798426,"url":"https://github.com/europanite/rag_container_template","last_synced_at":"2026-04-14T00:31:34.197Z","repository":{"id":326775740,"uuid":"1105930943","full_name":"europanite/rag_container_template","owner":"europanite","description":"A Full-Stack RAG Container Template","archived":false,"fork":false,"pushed_at":"2025-12-12T06:53:31.000Z","size":1158,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":0,"default_branch":"main","last_synced_at":"2025-12-13T08:24:54.246Z","etag":null,"topics":["chromadb","docker","docker-compose","expo","fastapi","full-stack","jest","llama","llm","local-llm","natural-language-processing","nlp","ollama","postgres","pytest","rag","react","react-native","retrival-augmented-generation"],"latest_commit_sha":null,"homepage":"https://europanite.github.io/rag_container_template/","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/europanite.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":"CONTRIBUTING.md","funding":null,"license":"LICENSE","code_of_conduct":"CODE_OF_CONDUCT.md","threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":"SECURITY.md","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":"2025-11-28T11:15:02.000Z","updated_at":"2025-12-12T13:07:13.000Z","dependencies_parsed_at":null,"dependency_job_id":null,"html_url":"https://github.com/europanite/rag_container_template","commit_stats":null,"previous_names":["europanite/rag_container_template"],"tags_count":0,"template":true,"template_full_name":null,"purl":"pkg:github/europanite/rag_container_template","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/europanite%2Frag_container_template","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/europanite%2Frag_container_template/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/europanite%2Frag_container_template/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/europanite%2Frag_container_template/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/europanite","download_url":"https://codeload.github.com/europanite/rag_container_template/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/europanite%2Frag_container_template/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":31776869,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-04-14T00:11:49.126Z","status":"ssl_error","status_checked_at":"2026-04-14T00:10:29.837Z","response_time":93,"last_error":"SSL_connect returned=1 errno=0 peeraddr=140.82.121.6:443 state=error: 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":["chromadb","docker","docker-compose","expo","fastapi","full-stack","jest","llama","llm","local-llm","natural-language-processing","nlp","ollama","postgres","pytest","rag","react","react-native","retrival-augmented-generation"],"created_at":"2026-04-14T00:31:32.042Z","updated_at":"2026-04-14T00:31:34.183Z","avatar_url":"https://github.com/europanite.png","language":"Python","funding_links":[],"categories":["Python"],"sub_categories":[],"readme":"# [RAG Container Template](https://github.com/europanite/rag_container_template \"RAG Container Template\")\n\n[![License](https://img.shields.io/badge/License-Apache_2.0-blue.svg)](https://opensource.org/licenses/Apache-2.0)\n![OS](https://img.shields.io/badge/OS-Linux%20%7C%20macOS%20%7C%20Windows-blue)\n[![Python](https://img.shields.io/badge/python-3.9|%203.10%20|%203.11|%203.12|%203.13-blue)](https://www.python.org/)\n[![CI](https://github.com/europanite/rag_container_template/actions/workflows/ci.yml/badge.svg)](https://github.com/europanite/rag_container_template/actions/workflows/ci.yml)\n[![Python Lint](https://github.com/europanite/rag_container_template/actions/workflows/lint.yml/badge.svg)](https://github.com/europanite/rag_container_template/actions/workflows/lint.yml)\n[![CodeQL Advanced](https://github.com/europanite/rag_container_template/actions/workflows/codeql.yml/badge.svg)](https://github.com/europanite/rag_container_template/actions/workflows/codeql.yml)\n[![pages-build-deployment](https://github.com/europanite/rag_container_template/actions/workflows/pages/pages-build-deployment/badge.svg)](https://github.com/europanite/rag_container_template/actions/workflows/pages/pages-build-deployment)\n\n![Python](https://img.shields.io/badge/python-3670A0?style=for-the-badge\u0026logo=python\u0026logoColor=ffdd54)\n![Pytest](https://img.shields.io/badge/pytest-%23ffffff.svg?style=for-the-badge\u0026logo=pytest\u0026logoColor=2f9fe3)\n![FastAPI](https://img.shields.io/badge/FastAPI-005571?style=for-the-badge\u0026logo=fastapi)\n![React Native](https://img.shields.io/badge/react_native-%2320232a.svg?style=for-the-badge\u0026logo=react\u0026logoColor=%2361DAFB)\n![TypeScript](https://img.shields.io/badge/typescript-%23007ACC.svg?style=for-the-badge\u0026logo=typescript\u0026logoColor=white)\n![Jest](https://img.shields.io/badge/-jest-%23C21325?style=for-the-badge\u0026logo=jest\u0026logoColor=white)\n![Expo](https://img.shields.io/badge/expo-1C1E24?style=for-the-badge\u0026logo=expo\u0026logoColor=#D04A37)\n\n![\"UI\"](./assets/images/frontend.png)\n\nThis repository is a full-stack sandbox for building a **local Retrieval-Augmented Generation (RAG)** system.  \nThe backend is a FastAPI service with authentication and a RAG API, using **ChromaDB** as a persistent vector store and **Ollama** for both embeddings and chat. The frontend is an Expo / React Native app that talks to the backend.\n\n---\n\n## Features\n\n- **Backend**\n  - FastAPI\n\n- **Frontend**\n  - Expo / React-Native\n\n- **DataBase**\n  - PostgreSQL\n\n- **RAG (Retrieval-Augmented Generation)**\n  - **Embeddings** with Ollama\n  - **Vector store** with ChromaDB\n  - **Chat / Answer generation** \n\n- **DevOps**\n  - **Docker Compose**\n  - GitHub Actions workflows\n\n---\n\n## Architecture\n\n```text\n+-----------------------------+\n|        Frontend (Expo)      |\n|  - React Native app         |\n|  - Calls backend /auth,     |\n|    /items, /rag endpoints   |\n+--------------+--------------+\n               |\n               v\n+-----------------------------+\n|       Backend (FastAPI)     |\n|  - Auth \u0026 Items routers     |\n|  - RAG router (/rag/...)    |\n|  - SQLAlchemy + Postgres    |\n+--------------+--------------+\n               |\n       +-------+----------+\n       |                  |\n       v                  v\n+-------------+   +------------------+\n|  ChromaDB   |   |   Ollama (LLM)   |\n|  Vector DB  |   |  /api/chat       |\n|  /chroma_db |   |  /api/embeddings |\n+-------------+   +------------------+\n```\n\n---\n\n## 🚀 Getting Started\n\n### 1. Prerequisites\n- [Docker Compose](https://docs.docker.com/compose/)\n- [Expo Go](https://expo.dev/go)\n\n### 2. Build and start all services:\n\n```bash\n# set environment variables:\nexport REACT_NATIVE_PACKAGER_HOSTNAME=${YOUR_HOST}\n\n# Build the image\ndocker compose build\n\n# Run the container\ndocker compose up\n```\n---\n\n### 3. Test:\n\n```bash\n# Backend pytest\ndocker compose \\\n  -f docker-compose.test.yml run \\\n  --rm \\\n  --entrypoint /bin/sh backend_test \\\n  -lc 'pytest -q'\n\n# Backend Lint\ndocker compose \\\n  -f docker-compose.test.yml run \\\n  --rm \\\n  --entrypoint /bin/sh backend_test \\\n  -lc 'ruff check /app /tests'\n\n# Frontend Test\ndocker compose \\\n  -f docker-compose.test.yml run \\\n  --rm frontend_test\n```\n\n## Visit the services:\n\n- Backend API: http://localhost:8000/docs\n![\"backend\"](./assets/images/backend.png)\n\n- Frontend UI (WEB): http://localhost:8081\n- Frontend UI (mobile): exp://${YOUR_HOST}:8081: access it with the QR provided by Expo.\n![\"expo\"](./assets/images/expo.png)\n\n---\n\n## RAG API\n\n### Ingest documents\n\n#### POST /rag/ingest\n\n```bash\ncurl -X POST http://localhost:8000/rag/ingest \\\n  -H \"Content-Type: application/json\" \\\n  -d '{\n    \"documents\": [\n      {\n        \"id\": \"miura_intro_001\",\n        \"text\": \"Miura Peninsula is located in Kanagawa, south of Yokohama. It is famous for its coastline, fresh seafood, and views of Mount Fuji on clear days.\",\n        \"source\": \"local-notes\"\n      }\n    ]\n  }'\n```\n\n#### Response:\n```bash\n{\n  \"total_chunks\": 1\n}\n```\n\n### Ask a question\n\n#### POST /rag/query\n\n```bash\ncurl -X POST http://localhost:8000/rag/query \\\n  -H \"Content-Type: application/json\" \\\n  -d '{\n    \"question\": \"Where is the Miura Peninsula and what is it famous for?\",\n    \"top_k\": 5\n  }'\n```\n\n#### Example response:\n\n```bash\n{\n  \"answer\": \"The Miura Peninsula is in Kanagawa, south of Yokohama. It is known for its coastline, fresh seafood, and views of Mount Fuji on clear days.\",\n  \"chunks\": [\n    {\n      \"id\": \"miura_intro_001_0\",\n      \"text\": \"...\",\n      \"source\": \"local-notes\",\n      \"chunk_index\": 0,\n      \"distance\": 0.01\n    }\n  ]\n}\n```\n\n---\n\n# License\n- Apache License 2.0","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Feuropanite%2Frag_container_template","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Feuropanite%2Frag_container_template","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Feuropanite%2Frag_container_template/lists"}