DEV Community

Cover image for Building a Resilient Local RAG Backend Engine for Hacktoberfest 2026
Ankan Roy
Ankan Roy

Posted on

Building a Resilient Local RAG Backend Engine for Hacktoberfest 2026

 # Building a Resilient Local RAG Backend Engine

Python
FastAPI
Docker
PostgreSQL

🎃 Hacktoberfest 2026 Submission

For the Hacktoberfest 2026 DEV Challenge, I built a zero-dependency, local-first Retrieval-Augmented Generation (RAG) backend engine designed to run open-weight models completely offline.


🚀 What I Built

An asynchronous FastAPI backend paired with PostgreSQL (pgvector) and Ollama (llama3.2). The system allows querying local AI models with vector context retrieval without sending sensitive data to third-party cloud APIs.

GitHub logo AnkanJU / Hacktoberfest2026

Monorepo for Hacktoberfest 2026 projects, DEV.to AI Challenges, and Open-Source backend implementations.




  • Tech Stack: Python 3.13, FastAPI, Uvicorn, AsyncPG, Docker Compose, Ollama.

💡 Why Open-Source AI Matters

Running open-weight models like llama3.2 locally gives developers full data ownership and privacy. By keeping embeddings in pgvector and processing prompts locally via Ollama, sensitive data never leaves the local environment.


🛠️ Key Features & Architecture

  1. Asynchronous API: Built using FastAPI for low-latency request handling.
  2. Local Vector Search: PostgreSQL with the pgvector extension configured for HNSW indexing.
  3. Local Inference: Containerized Ollama instance running open-weight LLMs.
  4. Resilient Retries: Integrated fallback handling for reliable local execution.

🏃 How to Run Locally


bash
# Clone the repository
git clone [https://github.com/AnkanJU/Hacktoberfest2026.git](https://github.com/AnkanJU/Hacktoberfest2026.git)
cd Hacktoberfest2026/dev-challenge-week1-rag

# Install dependencies
pip install -r requirements.txt

# Start local infrastructure
docker compose up -d

# Run the API server
uvicorn main:app --reload
![ ](https://dev-to-uploads.s3.us-east-2.amazonaws.com/uploads/articles/y7g8jqwwapir8k498m3n.png)
![ ](https://dev-to-uploads.s3.us-east-2.amazonaws.com/uploads/articles/oqjise1tojhjj3uqx5h7.png)
Enter fullscreen mode Exit fullscreen mode

Top comments (0)