AI appsOne-timeFeatured
Ragbag
Next.js RAG starter: upload documents, chat with citations, bill by usage
About this starter
Ragbag is a starting point for chat-with-your-documents products. Users upload PDFs, Word files and web pages, which are chunked, embedded and stored in Postgres with pgvector. Chat answers stream through the Vercel AI SDK with inline citations that link back to the source page. It includes teams with shared libraries, Stripe metered billing on tokens, and an admin view of costs per account.
It is opinionated about Postgres for everything, vectors included, so there is one database to back up. Model providers are swappable through a single config file. The limitation: ingestion runs in the request cycle with a background fallback, and documents over a few hundred pages time out on serverless hosts unless you move parsing to a worker.
Highlights
- 01Answers cite the exact page they came from
- 02Per-account model cost tracking in admin
- 03Switch model providers in one config file