A full-stack Retrieval-Augmented Generation (RAG) application with a FastAPI backend and a Vite+React frontend.
├── main.py
├── utils/ # Backend API routes
├── rag_chain.py # RAG chain implementation
├── requirements.txt # Python dependencies
├── drive-rag/ # Frontend application
│ ├── package.json
│ └── ...
└── .env # Environment variables (not committed)-
main.py: Contains all API routes exposed by the FastAPI backend & responsible for request handling, orchestration, and streaming responses. -
rag_chain.py: Contains the RAG chain implementation & handles retrieval, prompt construction, and LLM invocation logic.
pip install -r requirements.txtCreate a .env file in the project root:
OPENAI_API_KEY=your_openai_api_key_hereEnsure this file is not committed to version control.
Navigate to the frontend directory and install dependencies:
cd drive-rag
npm installFrom the project root:
uvicorn main:app --reloadThe backend will start in development mode with hot reload enabled.
From the drive-rag directory:
npm run devTo run the complete application start the backend and the frontend simultaneously.
- Ensure the backend is running before initiating frontend requests.
- API URLs and ports should align between frontend and backend configurations.
- This setup is intended for local development.
MongoDB and Gemini API env variables must be set in a .env file in the root directory.