The verdict: can you vibe code Afforai?
You can build a fully functional personal RAG literature assistant over a couple of weekends, bypassing monthly subscription fees if you only need it for your own research.
The core engine relies on standard retrieval-augmented generation patterns, vector search, and a PDF viewer. While parsing messy multi-column academic papers cleanly will test your patience with chunking strategies and extraction edge cases, AI coding agents make scaffolding the database schemas, API routes, and split-screen interface straightforward. The main hurdle is getting PDF text layouts and citation anchoring to line up smoothly without endless prompt tweaking.
Estimated effort: 2-3 weekends of focused building and debugging
What you can't replicate
- Afforai's hosted cloud infrastructure and team collaboration network
- Legacy user database and billing systems
Founded
2023
Raised
—
Team
4
Cheapest paid tier
$0/mo
What Afforai does
An AI-powered reference manager and literature review assistant that helps users source, summarize, translate, annotate, and cite academic papers using RAG.
Core features
- PDF upload, text extraction, and chunking pipeline
- Vector embeddings generation and semantic search
- Multi-document RAG querying with inline citations
- Split-screen document viewer with interactive citation jumps
- Document translation and summarization tools
- Citation generator and export manager
The business
Pricing
- Free$0/mo
- Unlimited$8/mo
- Team$16/mo
Funding
Unknown / bootstrapped
Pay vs build, cumulative
Break-even at month 8 — after that, every month is money kept.
The hard parts of vibe coding Afforai
- Extracting clean text, tables, and multi-column formatting from dense academic PDFs without losing context
- Orchestrating hybrid keyword/semantic retrieval and reranking to prevent AI hallucinations across massive corpora
- Managing token limits and context window allocation during simultaneous multi-file querying
- Syncing split-screen UI state so clicking an inline citation scrolls the PDF reader to the exact source paragraph
How to vibecode Afforai
Prerequisites
Node.jsfree
Runtime environment for the Next.js full-stack framework
GitHubfree
Version control and repository hosting
OpenAI API KeyPay-per-token (~$5-10/mo)
Generates text embeddings and powers the RAG synthesis engine
AI coding tools
Recommended stack
| Frontend | Next.js with Tailwind CSS and shadcn/ui components |
|---|---|
| Backend | Next.js App Router API endpoints |
| Database | Neon (Postgres with pgvector extension) |
| Auth | better-auth |
| Payments | None (personal use) |
| Other | Vercel AI SDK for LLM integration, pdf-parse or unpdf for document extraction |
Build guide
01Project Scaffolding and Database Schema
Initialize the Next.js application with TypeScript, Tailwind CSS, and shadcn/ui. Configure Drizzle ORM connected to Neon Postgres with the pgvector extension enabled, defining tables for documents, chunks, and chat messages.
Create a new Next.js 16 project using TypeScript, App Router, and Tailwind CSS. Install Drizzle ORM and set up the connection configuration for Neon Postgres. Define database schemas in lib/db/schema.ts for users, documents (id, title, file_url, created_at), document_chunks (id, document_id, content, chunk_index, embedding vector(1536)), and chat_conversations/messages. Ensure pgvector extension support is included in the schema definition.02PDF Upload and Text Extraction Pipeline
Implement a file upload endpoint that accepts research PDFs, stores files securely, extracts raw text using a parsing library, and splits the content into manageable overlapping chunks.
Build a server action and API endpoint in Next.js to handle multi-file PDF uploads. Integrate a robust PDF text extraction library (such as pdf-parse or unpdf) to pull raw text from uploaded files. Implement a chunking utility function that splits extracted text into 500-token segments with a 50-token overlap, preserving metadata like page numbers where possible.03Embedding Generation and Vector Storage
Integrate the OpenAI embeddings API to vectorize text chunks and store them in Neon Postgres using pgvector for semantic retrieval.
Write a background processing pipeline that takes newly chunked document segments, calls the OpenAI text-embedding-3-small API to generate vector embeddings, and inserts them into the document_chunks table in Neon Postgres. Add an error handling wrapper for rate limits and retries during bulk vectorization.04RAG Query Engine and Multi-File Chat
Build the semantic search retrieval mechanism and chat endpoint that queries multiple uploaded documents simultaneously using vector similarity and streams responses.
Create a RAG chat API route using the Vercel AI SDK. When a user submits a query, generate an embedding for the query text, perform a vector similarity search across document_chunks using pgvector cosine distance, and retrieve the top relevant context blocks. Construct a prompt incorporating these chunks with inline citation tags (e.g. [Doc ID, Chunk Index]) and stream the synthesized response back to the client.05Split-Screen UI and Interactive Citation Viewer
Develop a responsive split-screen dashboard layout featuring a document management sidebar, a chat interface with streaming answers, and an embedded PDF viewer that jumps to citation sources.
Build a responsive split-screen dashboard UI using Tailwind CSS and shadcn/ui. The left side should feature a document library list and file uploader. The center/right side should contain a chat interface supporting streaming markdown responses. Implement clickable inline citation badges in chat messages that, when clicked, trigger the embedded PDF viewer to highlight and scroll to the corresponding page and paragraph.06Authentication and Polish
Integrate better-auth for secure user login and session management, and refine error handling, loading states, and UI styling.
Integrate better-auth into the Next.js application for email/password authentication, securing all dashboard routes and associating uploaded documents and chat histories with the authenticated user ID. Add loading skeletons for PDF processing and empty states for the document library.
Cost vs paying for Afforai
What will you build it with?
Starting total with Cursor$0 one-time
Starting costs (one-time)
- AI Coding Assistant Pro subscription$20
- OpenAI API starting credits$10
Total~$30 one-time
Ongoing costs (monthly)
- OpenAI API usage (embeddings + chat queries)~$3-5/mo
- Vercel & Neon hosting$0/mo (Free tiers)
Total~$4/mo
Paying for Afforai
$8/mo - $16/mo
Your time to build
12-18 hours
AI tool credits
$20 (Cursor/Claude Pro for one month)
Break-even
4 months
Vibe code Afforai: FAQ
- Can you vibe code Afforai yourself?
- Solid side project — 75/100 vibecodeable. You can build a fully functional personal RAG literature assistant over a couple of weekends, bypassing monthly subscription fees if you only need it for your own research.
- How long does it take to vibe code Afforai?
- 2-3 weekends of focused building and debugging — roughly 12-18 hours of hands-on time with an AI coding agent.
- How do you build your own Afforai?
- Scoped to personal use: Next.js with Tailwind CSS and shadcn/ui components on the front, Next.js App Router API endpoints behind it, Neon (Postgres with pgvector extension) for data. Follow the 6-step build guide on this page — each step has a paste-ready prompt for an AI coding agent.
- How do you code your own Afforai without being an expert?
- Use an AI coding tool (Cursor or Claude Code) and work in small steps: scaffold, data model, core screens, then deploy. Realistic effort: 2-3 weekends of focused building and debugging. The prompts on this page are written so the AI does the heavy lifting.
- How much does it cost to vibe code Afforai instead of paying?
- About ~$30 one-time to start and ~$4/mo to run, versus $8/mo - $16/mo for Afforai. Break-even: 4 months.
- What stack should you use to vibe code Afforai?
- Next.js with Tailwind CSS and shadcn/ui components; Next.js App Router API endpoints; Neon (Postgres with pgvector extension); plus Vercel AI SDK for LLM integration, pdf-parse or unpdf for document extraction.