New: six AI app starters, tested with real usage-based billingSee AI starters

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

Tags

Related starters

More in AI apps
  • Django pipeline starter for AI document extraction, priced per page

    • extraction
    • ocr
    • django
    Subscription$29/mo
  • Credits, metered billing and rate limits for AI products, on Next.js

    • credits
    • stripe meters
    • rate limits
    One-time$249 once
  • Image-generation SaaS starter with credits, galleries and R2 storage

    • image generation
    • credits
    • replicate
    One-time$149 once
Live demo · Forkable— View template →