{"id":18049372,"url":"https://github.com/adithya-s-k/RAG-SaaS","last_synced_at":"2025-03-27T20:30:33.316Z","repository":{"id":254508301,"uuid":"839061890","full_name":"adithya-s-k/RAG-SaaS","owner":"adithya-s-k","description":"⚡Ship RAG Solutions Quickly and effortlessly","archived":false,"fork":false,"pushed_at":"2024-08-30T15:40:36.000Z","size":1227,"stargazers_count":79,"open_issues_count":0,"forks_count":6,"subscribers_count":3,"default_branch":"main","last_synced_at":"2024-10-11T18:56:45.297Z","etag":null,"topics":["ai-saas","arize-phoenix","llamaindex","mongodb","qdrant","rag","saas","saas-boilerplate"],"latest_commit_sha":null,"homepage":"https://rag-saas.vercel.app","language":"TypeScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"other","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/adithya-s-k.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}},"created_at":"2024-08-06T22:25:07.000Z","updated_at":"2024-10-11T12:22:13.000Z","dependencies_parsed_at":"2024-08-23T23:26:33.771Z","dependency_job_id":"aea40d91-d451-42bb-a47a-652b85556621","html_url":"https://github.com/adithya-s-k/RAG-SaaS","commit_stats":null,"previous_names":["adithya-s-k/rag-saas"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/adithya-s-k%2FRAG-SaaS","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/adithya-s-k%2FRAG-SaaS/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/adithya-s-k%2FRAG-SaaS/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/adithya-s-k%2FRAG-SaaS/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/adithya-s-k","download_url":"https://codeload.github.com/adithya-s-k/RAG-SaaS/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":222308099,"owners_count":16964309,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","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":["ai-saas","arize-phoenix","llamaindex","mongodb","qdrant","rag","saas","saas-boilerplate"],"created_at":"2024-10-30T21:01:38.957Z","updated_at":"2024-10-30T21:03:31.404Z","avatar_url":"https://github.com/adithya-s-k.png","language":"TypeScript","funding_links":[],"categories":["TypeScript"],"sub_categories":[],"readme":"\u003ch2 align=\"center\"\u003eRAG SaaS\u003c/h2\u003e\n\u003cp align=\"center\"\u003e\n  Ship RAG solutions quickly⚡\n\u003c/p\u003e\n\n\u003cp align=\"center\"\u003e\n  \u003cimg alt=\"RAG-SaaS Logo\" src=\"./assets/banner.png\" width=\"80%\"\u003e\n\u003c/p\u003e\n\n\u003cp align=\"center\"\u003e\n  \u003cstrong\u003eA end to end SaaS Solution for Retrieval-Augmented Generation (RAG) \u003cbr\u003e and Agentic based applications.\u003c/strong\u003e\u003cbr\u003e\n\n\u003c/p\u003e\n\n\u003cp align=\"center\"\u003e\n  \u003ca href=\"#-features\"\u003eFeatures\u003c/a\u003e ·\n  \u003ca href=\"#%EF%B8%8F-tech-stack\"\u003eTech Stack\u003c/a\u003e ·\n  \u003ca href=\"#-getting-started\"\u003eGetting Started\u003c/a\u003e ·\n  \u003ca href=\"#-docker-compose-deployment\"\u003eDeployment\u003c/a\u003e ·\n  \u003ca href=\"#roadmap\"\u003eRoadmap\u003c/a\u003e\n\u003c/p\u003e\n\n\u003cp align=\"center\"\u003e\n  \u003ca href=\"https://github.com/adithya-s-k/RAG-SaaS/stargazers\"\u003e\n    \u003cimg src=\"https://img.shields.io/github/stars/adithya-s-k/RAG-SaaS?style=social\" alt=\"GitHub Stars\"\u003e\n  \u003c/a\u003e\n  \u003ca href=\"https://github.com/adithya-s-k/RAG-SaaS/network/members\"\u003e\n    \u003cimg src=\"https://img.shields.io/github/forks/adithya-s-k/RAG-SaaS?style=social\" alt=\"GitHub Forks\"\u003e\n  \u003c/a\u003e\n  \u003ca href=\"https://github.com/adithya-s-k/RAG-SaaS/issues\"\u003e\n    \u003cimg src=\"https://img.shields.io/github/issues/adithya-s-k/RAG-SaaS\" alt=\"GitHub Issues\"\u003e\n  \u003c/a\u003e\n  \u003ca href=\"https://github.com/adithya-s-k/RAG-SaaS/pulls\"\u003e\n    \u003cimg src=\"https://img.shields.io/github/issues-pr/adithya-s-k/RAG-SaaS\" alt=\"GitHub Pull Requests\"\u003e\n  \u003c/a\u003e\n\u003c/p\u003e\n\n\n\n\u003ctable\u003e\n    \u003ctr\u003e\n        \u003cth\u003eFeatures\u003c/th\u003e\n        \u003cth\u003eDemo Video\u003c/th\u003e\n    \u003c/tr\u003e\n    \u003ctr\u003e\n        \u003ctd\u003e\n            \u003cul\u003e\n                \u003cli\u003e🔐 Basic Authentication\u003c/li\u003e\n                \u003cli\u003e💬 Chat History Tracking\u003c/li\u003e\n                \u003cli\u003e🧠 Multiple RAG Variations\n                    \u003cul\u003e\n                        \u003cli\u003eBasic RAG\u003c/li\u003e\n                        \u003cli\u003eTwo additional configurations\u003c/li\u003e\n                    \u003c/ul\u003e\n                \u003c/li\u003e\n                \u003cli\u003e👨‍💼 Admin Dashboard\n                    \u003cul\u003e\n                        \u003cli\u003e📥 Data Ingestion\u003c/li\u003e\n                        \u003cli\u003e📊 Monitoring\u003c/li\u003e\n                        \u003cli\u003e👁️ Observability\u003c/li\u003e\n                        \u003cli\u003e🔄 RAG Configuration Switching\u003c/li\u003e\n                    \u003c/ul\u003e\n                \u003c/li\u003e\n                \u003cli\u003e🗄️ S3 Integration for PDF uploads\u003c/li\u003e\n                \u003cli\u003e🐳 Easy Deployment with Docker / Docker Compose\u003c/li\u003e\n            \u003c/ul\u003e\n        \u003c/td\u003e\n        \u003ctd\u003e\n          \u003cdiv align=\"center\"\u003e\n  \n![f937cd54-217f-4106-81b6-56636a17306f (1)](https://github.com/user-attachments/assets/2f2c75fa-a3f0-4311-9a43-554d8cb3e04e)\n\u003c/div\u003e\n        \u003c/td\u003e\n    \u003c/tr\u003e\n\u003c/table\u003e\n\n\u003cdiv align=\"center\"\u003e\n\u003cvideo width=\"100%\" src=\"https://github.com/user-attachments/assets/f6de3ae5-bcc9-480c-bc46-dee69ec22795\" alt=\"Demo Video RAG SAAS\"\u003e\n\u003c/div\u003e\n\n\n## Tech Stack\n\n- 🦙 LlamaIndex: For building and orchestrating RAG pipelines\n- 📦 MongoDB: Used as both a normal database and a vector database\n- ⚡ FastAPI: Backend API framework\n- ⚛️ Next.js: Frontend framework\n- 🔍 Qdrant: Vector database for efficient similarity search\n- 👁️ Arize Phoenix: Observability Platform to monitor/evaluate your RAG system\n\n## 🌟 Why RAG-SaaS?\n\nSetting up reliable RAG systems can be time-consuming and complex. RAG-SaaS allows developers to focus on fine-tuning and developing their RAG pipeline rather than worrying about packaging it into a usable application. Built on top of [create-llama](https://www.llamaindex.ai/blog/create-llama-a-command-line-tool-to-generate-llamaindex-apps-8f7683021191) by LlamaIndex, RAG-SaaS provides a solid foundation for your RAG-based projects.\n\n## 🚀 Getting Started\n\n1. Clone the repository:\n   ```bash\n   git clone https://github.com/adithya-s-k/RAG-SaaS.git\n   cd RAG-SaaS\n   ```\n\n## 🐳 Docker Compose Deployment\n\n### Environment Variables\n\n\u003cdetails\u003e\n\u003csummary\u003e🔑 How to Set up .env\u003c/summary\u003e\n\n### Environment Variables\n\nTo properly configure and run RAG-SaaS, you need to set up several environment variables. These are divided into three main sections: Frontend, Backend, and Docker Compose. Here's a detailed explanation of each:\n\n#### Frontend Environment (./frontend/.env.local)\n\n- `NEXT_PUBLIC_SERVER_URL`: (Compulsory) The endpoint URL of your FastAPI server.\n- `NEXT_PUBLIC_CHAT_API`: (Compulsory) Derived from NEXT_SERVER_URL, typically set to `${NEXT_PUBLIC_SERVER_URL}/api/chat`.\n\n#### Backend Environment (./backend/.env)\n\n1. Model Configuration:\n\n   - `MODEL_PROVIDER`: (Compulsory) The AI model provider (e.g., 'openai').\n   - `MODEL`: (Compulsory) The name of the LLM model to use.\n   - `EMBEDDING_MODEL`: (Compulsory) The name of the embedding model.\n   - `EMBEDDING_DIM`: (Compulsory) The dimensionality of the embedding model.\n\n2. OpenAI Configuration:\n\n   - `OPENAI_API_KEY`: (Compulsory) Your OpenAI API key.\n\n3. Application Settings:\n\n   - `CONVERSATION_STARTERS`: (Compulsory) A list of starter questions for users.\n   - `SYSTEM_PROMPT`: (Compulsory) The system prompt for the AI model.\n   - `SYSTEM_CITATION_PROMPT`: (Optional) Additional prompt for citation.\n   - `APP_HOST`: (Compulsory) The host address for the backend (default: '0.0.0.0').\n   - `APP_PORT`: (Compulsory) The port for the backend (default: 8000).\n\n4. Database Configuration:\n\n   - `MONGODB_URI`: (Compulsory) The MongoDB connection URI.\n   - `MONGODB_NAME`: (Compulsory) The MongoDB database name (default: 'RAGSAAS').\n   - `QDRANT_URL`: (Compulsory) The URL for the Qdrant server.\n   - `QDRANT_COLLECTION`: (Compulsory) The Qdrant collection name.\n   - `QDRANT_API_KEY`: (Optional) API key for Qdrant authentication.\n\n5. Authentication:\n\n   - `JWT_SECRET_KEY`: (Compulsory) Secret key for signing JWT tokens.\n   - `JWT_REFRESH_SECRET_KEY`: (Compulsory) Secret key for signing JWT refresh tokens.\n   - `ADMIN_EMAIL`: (Compulsory) Administrator email for application login.\n   - `ADMIN_PASSWORD`: (Compulsory) Administrator password for application login.\n\n6. AWS S3 Configuration (Optional):\n\n   - `AWS_ACCESS_KEY_ID`: AWS Access Key ID.\n   - `AWS_SECRET_ACCESS_KEY`: AWS Secret Access Key.\n   - `AWS_REGION`: AWS Region for your services.\n   - `BUCKET_NAME`: The name of the S3 bucket to use.\n\n7. Observability:\n   - `ARIZE_PHOENIX_ENDPOINT`: (Optional) Endpoint for Arize Phoenix observability.\n\n#### S3 Integration\n\nTo enable S3 integration for PDF uploads/Ingestion:\n\n1. Set the following environment variables in your `.env` file:\n\n```\n\nAWS_ACCESS_KEY_ID=your_access_key\nAWS_SECRET_ACCESS_KEY=your_secret_key\nAWS_REGION=bucket_region\nBUCKET_NAME=your_bucket_name\n\n```\n\n### Docker Compose Env (./env)\n\n```\n  backend:\n    build:\n      context: ./backend\n      dockerfile: Dockerfile\n    image: ragsaas/backend:latest\n    container_name: backend\n    ports:\n      - '8000:8000'\n    environment:\n      # MongoDB Configuration\n      MONGODB_NAME: RAGSAAS\n      MONGODB_URI: mongodb://admin:password@mongodb:27017/\n      # Qdrant Configuration\n      QDRANT_COLLECTION: default\n      QDRANT_URL: http://qdrant:6333\n      # QDRANT_API_KEY:\n      # OPENAI_API_KEY is compulsory\n      OPENAI_API_KEY:\n      # Backend Application Configuration\n      MODEL_PROVIDER: openai\n      MODEL: gpt-4o-mini\n      EMBEDDING_MODEL: text-embedding-3-small\n      EMBEDDING_DIM: 1536\n      FILESERVER_URL_PREFIX: http://backend:8000/api/files\n      SYSTEM_PROMPT: 'You are a helpful assistant who helps users with their questions.'\n      APP_HOST: 0.0.0.0\n      APP_PORT: 8000\n      JWT_SECRET_KEY:\n      JWT_REFRESH_SECRET_KEY:\n      ARIZE_PHOENIX_ENDPOINT: http://arizephoenix:4317\n```\n\n\u003c/details\u003e\n\nFor Docker Compose deployment, use:\n\n```bash\ndocker compose up -d\n```\n\nPull down the containers\n\n```bash\ndocker compose down\n```\n\n### Development Mode\n\nTo run the project in development mode, follow these steps:\n\n1. **Start the Next.js Frontend:**\n\n   Navigate to the `frontend` directory and install the required dependencies. Then, run the development server:\n\n   ```bash\n   cd frontend\n   npm install\n   npm run dev\n   ```\n\n2. **Set Up the Vector Database (Qdrant), Database (MongoDB), and Observability Platform (Arize Phoenix):**\n\n   You can either self-host these services using Docker or use hosted solutions.\n\n   **Self-Hosted Options:**\n\n   - Qdrant:\n\n     ```bash\n     docker pull qdrant/qdrant\n     ```\n\n   - MongoDB:\n\n     ```bash\n     docker pull mongo\n     ```\n\n   - Arize Phoenix:\n     ```bash\n     docker pull arizephoenix/phoenix\n     ```\n\n   **Hosted Options:**\n\n   - Qdrant Cloud: [Qdrant Cloud](https://cloud.qdrant.io/)\n   - MongoDB Atlas: [MongoDB Atlas](https://www.mongodb.com/cloud/atlas)\n   - Arize Phoenix: [Arize Phoenix](https://app.phoenix.arize.com/)\n\n3. **Start the FastAPI Server:**\n\n   Navigate to the `backend` directory and set up the Python environment. You can use either Conda or Python's built-in `venv`:\n\n   ```bash\n   cd backend\n   ```\n\n   **Using Conda:**\n\n   ```bash\n   conda create -n ragsaas-venv python=3.11\n   conda activate ragsaas-venv\n   ```\n\n   **Using Python's `venv`:**\n\n   ```bash\n   python -m venv ragsaas-venv\n   \\ragsaas-venv\\Scripts\\activate  # On Windows\n   source ragsaas-venv/bin/activate  # On macOS/Linux\n   ```\n\n   Install the required dependencies and run the server:\n\n   ```bash\n   pip install -e .\n   python main.py\n   ```\n\n---\n\n## Roadmap\n\n- [x] add support to store ingested data in AWS S3\n- [x] Add Docker compose for each set up\n- [x] Implement Observability\n- [ ] Improve authentication system\n- [ ] Integrate OmniParse API for efficient Data ingestion\n- [ ] Provide more control to Admin over RAG configuration\n- [ ] Implement Advanced and Agentic RAG\n\n## 👥 Contributing\n\nWe welcome contributions to RAG-SaaS! Please see our [CONTRIBUTING.md](CONTRIBUTING.md) for more details on how to get started.\n\n## 📄 Licensing\n\nThis project is available under a dual license:\n\n- Apache License 2.0 for students, developers, and individuals\n- GNU General Public License v3.0 for companies and commercial use\n\nSee the [LICENSING.md](LICENSING.md) file for more details.\n\n## 🙏 Acknowledgements\n\nThis project is built on the following frameworks, technologies and tools:\n\n- [LlamaIndex](https://www.llamaindex.ai/) for the create-llama tool and RAG orchestration\n- [FastAPI](https://fastapi.tiangolo.com/)\n- [Next.js](https://nextjs.org/)\n- [MongoDB](https://www.mongodb.com/)\n- [Qdrant](https://qdrant.tech/)\n- [Arize Phoenix](https://docs.arize.com/phoenix)\n\n## Contact \u0026 Support\n\n### Bug Reports\n\nIf you encounter any issues or bugs, please report them in the [Issues](https://github.com/adithya-s-k/RAG-SaaS/issues) tab of our GitHub repository.\n\n### Commercial Use \u0026 Custom Solutions\n\nFor inquiries regarding:\n\n- Commercial licensing\n- Custom modifications\n- Managed deployment\n- Specialized integrations\n\nPlease contact: adithyaskolavi@gmail.com\n\nWe're here to help tailor RAG-SaaS to your specific needs and ensure you get the most out of our solution.\n\n## Star History\n\n\u003cp align=\"center\"\u003e\n  \u003ca href=\"https://cognitivelab.in\"\u003e\n    \u003cimg src=\"https://api.star-history.com/svg?repos=adithya-s-k/RAG-SaaS\u0026type=Date\" alt=\"Star History Chart\"\u003e\n  \u003c/a\u003e\n\u003c/p\u003e\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fadithya-s-k%2FRAG-SaaS","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fadithya-s-k%2FRAG-SaaS","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fadithya-s-k%2FRAG-SaaS/lists"}