A Retrieval Augmented Generation (RAG) application built with React Router and modern AI capabilities.
- 📦 Upload documents to Vercel Blob Storage, with the option to keep the files or delete them after processing
- 📦 Document processing pipeline (PDF/text)
- 🔍 Semantic search with vector embeddings
- 📝 AI-powered summarization & metadata extraction
- 📊 Token usage tracking & analytics
- 🔒 Secure authentication with Supabase
- 🎨 TailwindCSS with shadcn/ui components
- 📈 Built-in usage statistics dashboard
- Node.js v20+
- Supabase CLI. A Supabase account is not needed for local development but it's required for deployment
- A Vercel account and a Vercel Blob Storage key
- OpenAI API key
In order to use the file upload feature, you need to have a Vercel Blob Storage key. To get one, you can follow the steps below:
- Deploy this project to Vercel
- Go to the Storage section
- Associate a Blob Store to the project
- Copy the
BLOB_READ_WRITE_TOKENkey
Finally, you will need to run a local tunnel to make the file upload feature work. You can use ngrok for this purpose.
ngrok http 3000Browse the application from the public URL provided by ngrok.
- Clone the repository
git clone https://github.com/your-username/react-router-rag.git- Bootstrap the project
npm run bootstrap- Set up environment variables, create a
.envfile in the root directory. Copy the Supabase project URL and service role key from the output of the bootstrap command and Vercel Blob Storage key from Vercel deployment environment variables.
cp .env.example .env- Start the development server
npm run dev- Open your browser and navigate to
http://localhost:3000to see the application in action.
The project is organized into the following directories:
app/
├── components/ # Reusable React components.
├── hooks/ # Custom React hooks.
├── prompts/ # Custom prompts for the AI.
├── services/ # AI processing services.
├── lib/ # Utility functions and helpers.
├── types/ # TypeScript type definitions.
├── utils/ # Utility functions.
supabase/ # Supabase configuration and migrations.
├── migrations/ # Supabase migrations.
├── seed.sql # Supabase seed data.
├── config.toml # Supabase config.
The project uses the following environment variables:
| Variable | Description |
|---|---|
SUPABASE_URL |
Supabase project URL |
SUPABASE_SERVICE_ROLE_KEY |
Supabase service role key |
OPENAI_API_KEY |
OpenAI API key |
BLOB_READ_WRITE_TOKEN |
Vercel Blob storage token |
The application provides three core AI capabilities:
-
Document Summarization
- Processes PDF/text files
- Generates embedding-friendly summaries
- Preserves key technical terms
-
Metadata Extraction
- Automatic document type detection
- Entity recognition
- Domain classification
-
Semantic Search
- Vector embeddings with OpenAI
- Context-aware retrieval
- Conversation history integration
- Fork the repository
- Create feature branch:
git checkout -b feature/my-feature- Make your changes and commit them:
git commit -m "Add my feature"- Push your changes to the branch:
git push origin feature/my-feature- Create a pull request:
git pull-requestPlease follow the Biome coding standards and include tests where applicable.
Create a production build:
npm run buildThis project is licensed under the MIT License. See the LICENSE file for details.
Built with ❤️ using React Router, Supabase, and OpenAI