theeaashish/Outbox-RAG ? reverse-engineered prompt
Reverse engineered prompt
Build me a production ready RAG backend for a knowledge base app.
I want users to upload documents to a knowledge base, have them saved safely, then processed in the background so the app does not block while embeddings are generated and chunks are stored. Use a durable database first workflow so document creation and the background job record happen together, and make sure duplicate processing is avoided. I also want a chat endpoint that searches the stored document chunks, sends the best context to an AI model, and streams the answer back to the client in real time with SSE.
Please include clean API routes for uploading documents and asking questions, status tracking for documents, and reliable pagination for listing results. The system should be built to handle retries, background workers, and operational failures without losing work. If you need current docs for any library or service behavior, look them up online.