AI RAG System
AI RAG System Production-Ready Document Intelligence Backend

Problem
this is full fledge system,
not just a demo built on stream lit.
Delivered
- Register, log in, and manage their own document library
- Upload PDF, DOCX, and TXT files (up to 50MB per file)
- View, organize, and delete uploaded documents
- Chat with their documents using natural language
Impact
. Real Security — Not Just Auth Access tokens expire in 30 minutes. Refresh tokens silently issue new ones. If an access token is ever compromised, the damage window is capped. This is how production systems handle authentication — not just "add JWT and call it done."
2. Database Migrations Done Right SQLAlchemy ORM + Alembic versioning. No manual SQL scripts, no "just run this query" instructions. Schema changes are tracked, reversible, and SQL-injection safe by design.
3. Background Task Processing Long-running operations (document ingestion, embedding generation) are offloaded to Celery + Redis workers. The API stays fast. Users don't wait.
4. Every Request Is Traceable Custom middleware assigns a unique request_id to every incoming request. Every log entry carries it. When something breaks in production, you filter by request_id and see exactly what happened. This is how real systems are debugged.
5. Model-Agnostic AI Layer OpenAI, HuggingFace, or Ollama — all configurable via .env. Switch models without touching a single line of code.
Tech stack
Architecture


