{"id":31468166,"url":"https://github.com/aghoshpro/fullstack-rag-analytics","last_synced_at":"2025-10-01T19:23:45.909Z","repository":{"id":313965137,"uuid":"374787834","full_name":"aghoshpro/Fullstack-RAG-Analytics","owner":"aghoshpro","description":"Fullstack AI + Data integration app to perform a “Natural Text-To-SQL” query using LangGraph \u0026 LLMs ChatGPT, Claude and Ollama ","archived":false,"fork":false,"pushed_at":"2025-09-19T10:43:41.000Z","size":4022,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-09-19T12:38:49.751Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"","language":"TypeScript","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/aghoshpro.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","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":"2021-06-07T20:08:21.000Z","updated_at":"2025-09-19T10:43:45.000Z","dependencies_parsed_at":"2025-09-09T21:05:16.527Z","dependency_job_id":"a5bab926-51b6-44e3-a08e-d72c78685be7","html_url":"https://github.com/aghoshpro/Fullstack-RAG-Analytics","commit_stats":null,"previous_names":["aghoshpro/rag-analytics","aghoshpro/fullstack-rag-analytics"],"tags_count":null,"template":false,"template_full_name":null,"purl":"pkg:github/aghoshpro/Fullstack-RAG-Analytics","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/aghoshpro%2FFullstack-RAG-Analytics","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/aghoshpro%2FFullstack-RAG-Analytics/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/aghoshpro%2FFullstack-RAG-Analytics/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/aghoshpro%2FFullstack-RAG-Analytics/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/aghoshpro","download_url":"https://codeload.github.com/aghoshpro/Fullstack-RAG-Analytics/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/aghoshpro%2FFullstack-RAG-Analytics/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":277896644,"owners_count":25896464,"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","status":"online","status_checked_at":"2025-10-01T02:00:09.286Z","response_time":88,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"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":[],"created_at":"2025-10-01T19:23:42.240Z","updated_at":"2025-10-01T19:23:45.890Z","avatar_url":"https://github.com/aghoshpro.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# RAG Analytics\n\nFullstack AI + Data integration project performs a “Text-To-SQL” query using LLMs ChatGPT, Claude and Ollama over a small dataset stored locally. More data can be added.\n\n\u003cimg src=\"./appGUI.gif\"\u003e\n\n\n\n## Key Highlights\n\n- **Fullstack Application**: Combines a React frontend with a LangGraph backend, representing each state of execution as a node.\n- **Automatic Routing**: Identifies which action to perform (RAG-based or analytics), addresses knowledge gaps, and refines searches.\n\n- The data files are located in the `backend/data` folder (including `products.csv` and `rules.md`), from which the `frontend/store` folder is created containing SQLite databases for both files and embeddings.\n\n- The project is organized into two main directories:\n\n  - `frontend/`: Contains the React application built with Vite.\n  - `backend/`: Contains the LangGraph/FastAPI application, including the agent logic.\n\n### Here's what the program does:\n\n1. **Data Ingestion \u0026 Indexing**: Raw data is ingested and indexed into a vector store.\n2. **Context Retrieval**: Retrieves relevant context for free-text questions.\n3. **Ad-hoc Analytics**: Performs SQL-style queries for analytics.\n4. **Natural Language Generation**: Generates natural answers via OpenAI, with a persona flag to adjust tone.\n5. **HTTP API Exposure**: Exposes a simple HTTP API.\n6. **Docker Containerization**: Containerizes the application for deployment.\n\n\n\n\u003c!-- \u003cimg src=\"./agent.png\" title=\"Agent Flow\" alt=\"Agent Flow\" width=\"50%\"\u003e --\u003e\n\n## TechStack Used\n\n- [React](https://reactjs.org/) (with [Vite](https://vitejs.dev/)) - For the frontend user interface.\n- [Tailwind CSS](https://tailwindcss.com/) - For styling.\n- [Shadcn UI](https://ui.shadcn.com/) - For ui components.\n- [LangGraph](https://github.com/langchain-ai/langgraph) - For building the backend research agent.\n- [Open AI](https://platform.openai.com/docs/models) - CHatGPT as LLM for query generation and answer synthesis.\n- [Ollama](https://ollama.com/) - Use local LLM like llama3.2, llama3.3 for query generation so the data stays in your local \n\n\n## Local Development and Testing\n\n### Prerequisites\n\n- **Node.js and npm** (or yarn/pnpm)\n- **Python 3.11+**\n- **API Keys**: The backend agent requires an OpenAI API key.\n  1. Navigate to the main directory.\n  2. navigate to the `backend\\` folder\n  3. Add the followings to the `.env` file \n     - OpenAI API key: `OPENAI_API_KEY`=sk-proj-..........\n     - LangSmith API Key: `LANGSMITH_API_KEY`=lsv2_...........\n\n## Frontend (ReactJs + TypeScript)\n\n- Go to `frontend\\` and use `npm` to download node modules\n\n  ```bash\n  cd frontend\n  ```\n\n  ```bash\n  npm install\n  ```\n\n- To fix vulnerabilities if occurs \n\n   - To address issues that do not require attention, run:\n      ```sh\n      npm audit fix\n      ```\n   - To address all issues (including breaking changes), run:\n     ```sh\n     npm audit fix --force\n     ```\n\n- Run the cmd to open frontend web app at  _`http://localhost:5173/app`_\n\n    ```sh\n    npm run dev\n    ```\n\n\n## Backend (Python + LangGraph)\n\n- Navigate to `backend\\`and use `uv` as the package manager to set up python env as stated in `pyproject.toml`.\n\n  ```bash\n  cd backend\n  ```\n\n  ```bash\n  uv sync\n  ```\n- Run the **LangGraph development server** with the `--allow-blocking` flag, which enables blocking operations in the agent workflow during development.\n\n  ```bash\n  uv run langgraph dev --allow-blocking\n  ```\n\n\n- The backend API will be available at `http://127.0.0.1:2024\\docs`. It will also open a browser window to the FastAPI docs where request can be accessed.  The core of the backend is a LangGraph agent defined in `backend/src/agent/graph.py` which follows the steps below:\n\n  \u003cimg src=\"./agent.png\" style=\"width:500px\"\u003e\n\n\n\u003c!-- For the frontend, open a terminal in the `frontend/` directory and run `npm run dev`.  --\u003e\n\n## Queries \n\nClick on `http://localhost:5173/app/` to see the web application.\n\n\n- What is the average, maximum and minimum turnover of each country?\n- What are the countries with the maximum turnover? \n- List all the countries segment wise\n\n\n## Deployment\n\n**1. Build the Docker Image:**\n\nNotice!: You might encounter some issue when building the image, I am currently fixing the error\n\nRun the following command from the **project root directory**: \n\n```bash\ndocker build -t hybrid-rag-service -f Dockerfile .\n```\n\n**2. Run the Production Server:**\n\n```bash\ndocker-compose up\n```\n\n## Project Folder Structure \n\nThe project is organized into two main directories:  The core of the backend is a LangGraph agent defined in backend/src/agent/graph.py. It follows these steps:\n\n### Backend Structure\n```\nbackend/\n├── .langgraph_api/\n├── src/\n│   ├── agent/\n│   │   ├── __init__.py\n│   │   ├── app.py\n│   │   ├── configuration.py\n│   │   ├── graph.py\n│   │   ├── router.py\n│   │   └── state.py\n│   ├── data/\n│   │   ├── products.csv\n│   │   └── rules.md\n│   ├── store/\n│   │   ├── analytic.sqlite\n│   │   └── rag.sqlite\n│   ├── wrangler/\n│   │   ├── embedding/\n│   │   │   ├── __init__.py\n│   │   │   ├── base.py\n│   │   │   └── openai.py\n│   │   ├── model/\n│   │   │   ├── __init__.py\n│   │   │   ├── chunk.py\n│   │   │   ├── document.py\n│   │   │   └── product.py\n│   │   ├── repository/\n│   │   │   ├── __init__.py\n│   │   │   ├── analytic.py\n│   │   │   ├── base.py\n│   │   │   ├── chunk.py\n│   │   │   ├── document.py\n│   │   │   └── store.py\n│   │   ├── __init__.py\n│   │   ├── ingest.py\n│   │   ├── qa_agent.py\n│   │   ├── queryTranslation.py\n│   │   ├── ragUtil.py\n│   │   └── repository.py\n│   └── __init__.py\n├── .venv/\n├── test-agent.ipynb\n├── uv.lock\n├── .gitignore\n├── langgraph.json\n├── LICENSE\n├── Makefile\n└── pyproject.toml\n```\n\n### Frontend Structure\n```\nfrontend/\n├── node_modules/\n├── public/\n│   └── vite.svg\n├── src/\n│   ├── components/\n│   │   ├── ui/\n│   │   │   ├── badge.tsx\n│   │   │   ├── button.tsx\n│   │   │   ├── card.tsx\n│   │   │   ├── input.tsx\n│   │   │   ├── scroll-area.tsx\n│   │   │   ├── select.tsx\n│   │   │   ├── tabs.tsx\n│   │   │   └── textarea.tsx\n│   │   ├── ActivityTimeline.tsx\n│   │   ├── ChatMessagesView.tsx\n│   │   ├── InputForm.tsx\n│   │   ├── TableView.tsx\n│   │   └── WelcomeScreen.tsx\n│   ├── lib/\n│   │   └── utils.ts\n│   ├── App.tsx\n│   ├── global.css\n│   ├── main.tsx\n│   └── vite-env.d.ts\n├── .gitignore\n├── components.json\n├── eslint.config.js\n├── index.html\n├── package-lock.json\n├── package.json\n├── tsconfig.json\n├── tsconfig.node.json\n└── vite.config.ts\n```","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Faghoshpro%2Ffullstack-rag-analytics","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Faghoshpro%2Ffullstack-rag-analytics","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Faghoshpro%2Ffullstack-rag-analytics/lists"}