-
Notifications
You must be signed in to change notification settings - Fork 0
Home

| Component | Requirement | Version |
|---|---|---|
| OS | macOS / Linux / Windows | Any modern |
| Node.js | JavaScript runtime | >= 20.x |
| npm | Node package manager | >= 9.x |
| Python | Python interpreter | >= 3.13 |
| pip | Python package manager | >= 23.x |
| Docker | Container runtime | >= 20.x |
| AWS CLI | AWS command-line interface | >= 2.x |
| Git | Version control | >= 2.x |
-
Clone this repository:
git clone https://github.com/your-org/rag-app.git cd rag-app -
Navigate into each subdirectory and set up environment variables.
Copy the sample .env.example files and set your own values.
-
Frontend (
frontend/.env.local):NEXT_PUBLIC_API_URL=http://localhost:3001 NEXT_PUBLIC_RAG_API_URL=http://localhost:8001
-
Backend (
backend/.env):PORT=3001 DATABASE_URL=postgresql://user:password@localhost:5432/yourdb JWT_SECRET=your_jwt_secret
-
RAG-Backend (
rag-backend/.env):OPENAI_API_KEY=your_openai_api_key CHROMA_DB_URL=postgresql://chroma:chroma@localhost:5432/chromadb FASTAPI_PORT=8001
cd frontend
npm install
npm run dev
# Open http://localhost:3000cd backend
npm install
npm run start:dev
# Open http://localhost:3001cd rag-backend
python3 -m venv .venv
source .venv/bin/activate
pip install -r requirements.txt
uvicorn app.main:app --reload --port ${FASTAPI_PORT:-8001}
# chroma run --port 8001 # To run Chroma-DB (vector store DB) in foregroundcd frontend
npm run testcd backend
npm run test:covCurrently no automated tests are provided. You can add tests using pytest.
cd rag-backend
pip install pytest
pytest-
Create ECR Repositories for each component or use GHCR:
aws ecr create-repository --repository-name frontend aws ecr create-repository --repository-name backend aws ecr create-repository --repository-name rag-backend
-
Authenticate Docker to ECR:
aws ecr get-login-password --region <region> | docker login --username AWS --password-stdin <aws_account_id>.dkr.ecr.<region>.amazonaws.com
-
Build and Push Docker Images:
# Frontend docker build -t frontend:latest frontend/ docker tag frontend:latest <ecr_uri>/frontend:latest docker push <ecr_uri>/frontend:latest # Backend docker build -t backend:latest backend/ docker tag backend:latest <ecr_uri>/backend:latest docker push <ecr_uri>/backend:latest # RAG-Backend docker build -t rag-backend:latest rag-backend/ docker tag rag-backend:latest <ecr_uri>/rag-backend:latest docker push <ecr_uri>/rag-backend:latest
-
Create an ECS Cluster (EC2 launch type, free-tier eligible):
aws ecs create-cluster --cluster-name rag-app-cluster
-
Register Task Definitions for each service, specifying container images, port mappings, environment variables, and IAM roles.
-
Create Services associated with the task definitions, attach to an Application Load Balancer (ALB), and configure an Auto Scaling group of EC2 instances (e.g., t2.micro).
-
Configure Networking:
- Security Groups to allow HTTP/HTTPS.
- Load Balancer listeners on ports 80/443.
- Set up Route 53 DNS if needed.
-
Deploy and verify each service is running:
aws ecs update-service --cluster rag-app-cluster --service frontend-service --desired-count 2 aws ecs update-service --cluster rag-app-cluster --service backend-service --desired-count 2 aws ecs update-service --cluster rag-app-cluster --service rag-backend-service --desired-count 2
| Endpoint | Method | Description |
|---|---|---|
/auth/register |
POST | Register a new user |
/auth/login |
POST | Authenticate and receive a JWT |
/users |
GET | List all users |
/users/:id |
GET | Get user by ID |
/documents |
GET | Retrieve all documents |
/documents |
POST | Upload/Create a new document |
/documents/:id |
GET | Get document by ID |
/ingestion |
POST | Trigger document ingestion |
| Endpoint | Method | Description |
|---|---|---|
/ingest |
POST | Ingest documents into the vector store |
/qa |
POST | Query the vector store and get an answer |
/health |
GET | Health check endpoint |
/docs |
GET | Automatic API documentation (Swagger UI) |
Note: Replace
<ecr_uri>,<aws_account_id>,<region>, and other placeholders with your actual values as needed.