Skip to content

Syn92/RAGProject

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

2 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

RAG System

A production-ready Retrieval Augmented Generation system built with Next.js, FastAPI, and AWS.

Features

  • 📝 Document processing and chunking
  • 🔍 Semantic search with pgvector
  • 💬 Streaming chat interface
  • 🚀 High-performance vector search
  • 🔒 Built-in authentication
  • 📊 Advanced monitoring

Tech Stack

Backend

  • FastAPI
  • PostgreSQL + pgvector
  • AWS Bedrock
  • Docker + ECS

Frontend

  • Next.js 14 (App Router)
  • shadcn/ui components
  • Tailwind CSS
  • TypeScript

Infrastructure

  • AWS (ECS, RDS, S3, Lambda)
  • Terraform

Getting Started

Prerequisites

  • Python 3.11+
  • Node.js 18+
  • Docker
  • AWS CLI configured
  • Terraform

Local Development

  1. Clone the repository
git clone https://github.com/yourusername/rag-system.git
cd rag-system
  1. Backend Setup
cd backend
python -m venv venv
source venv/bin/activate  # or `venv\Scripts\activate` on Windows
pip install -r requirements.txt
  1. Frontend Setup
cd frontend
npm install
  1. Environment Setup

Create .env files:

backend/.env:

DATABASE_URL=postgresql://user:pass@localhost:5432/rag
AWS_REGION=us-west-2
BEDROCK_MODEL_ID=anthropic.claude-v2
S3_BUCKET=your-rag-documents-bucket

frontend/.env.local:

NEXT_PUBLIC_API_URL=http://localhost:8000
NEXT_PUBLIC_UPLOAD_BUCKET=your-rag-documents-bucket
  1. Run Development Servers

Backend:

cd backend
uvicorn api.main:app --reload

Frontend:

cd frontend
npm run dev

Deployment

  1. Infrastructure Setup
cd infrastructure
terraform init
terraform apply
  1. Backend Deployment
docker build -f docker/backend.Dockerfile -t rag-backend .
docker push <ECR_REPO>/rag-backend:latest
  1. Frontend Deployment
cd frontend
npm run build
vercel deploy  # or your preferred hosting

Architecture

├── Document Upload
│   └── S3 Storage
├── Processing Pipeline
│   ├── Lambda Trigger
│   ├── Unstructured-IO
│   └── Embedding Generation
├── Vector Storage
│   └── PostgreSQL + pgvector
└── Query Pipeline
    ├── Semantic Search
    ├── Context Retrieval
    └── LLM Response

Project Structure

rag-system/
├── backend/
│   ├── api/
│   ├── indexer/
│   └── retriever/
├── frontend/
│   ├── app/
│   ├── components/
│   └── lib/
└── infrastructure/
    └── modules/

Configuration

Backend Configuration

Key configurations in backend/config.py:

  • Database settings
  • AWS credentials
  • Model parameters
  • Processing pipeline

Frontend Configuration

Key configurations in frontend/config.ts:

  • API endpoints
  • Authentication
  • UI theming
  • Feature flags

Contributing

  1. Fork the repository
  2. Create your feature branch
  3. Commit your changes
  4. Push to the branch
  5. Create a new Pull Request

License

This project is licensed under the MIT License - see the LICENSE file for details.

Acknowledgments

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors