### Talk with your books — upload a PDF, then explore it through voice Next.js · PostgreSQL · Prisma · Better Auth · Vapi · Tailwind — one app that turns static reading into interactive conversation.
     
[](#-license) [](#-features) [](#-how-it-works) [](#-tech-stack)
At a Glance
| ### Upload PDF to Vercel Blob · open chat immediately text indexed in the background | ### Voice Vapi live sessions · ask questions summaries · searchable book segments | ### Dashboard KPIs · charts · reading history notifications · light / dark literary theme |
Core flow
Sign in → Upload PDF → Save book → Open voice chat immediately
↓
Index segments in background (for search)
↓
Dashboard / Library → Continue reading · voice history
### System Architecture
```mermaid
flowchart LR
subgraph Client
Landing[Marketing Landing]
Dash[Dashboard]
Library[Library UI]
Chat[Book Voice Page]
end
subgraph App
Auth[Better Auth]
Upload[Upload API]
Actions[Book Actions]
end
subgraph Data
PG[(PostgreSQL)]
end
subgraph External
Vapi[Vapi Voice]
Blob[Vercel Blob]
end
Landing -->|sign in| Auth
Auth --> Dash
Dash --> Library
Library -->|upload| Upload
Upload --> Blob
Upload --> Actions
Actions --> PG
Library -->|open book| Chat
Chat --> Vapi
Vapi -->|search tool| Actions
```
### Voice Session Sequence
```mermaid
sequenceDiagram
participant User
participant Next as Next.js
participant Blob as Vercel Blob
participant PG as PostgreSQL
participant Vapi
User->>Next: Upload PDF
Next->>Blob: Store PDF
Next->>PG: Create owned book
Next-->>User: Open voice chat
Next->>PG: Index segments (background)
User->>Vapi: Ask about the book
Vapi->>Next: Search / retrieve context
Next->>PG: Query segments
PG-->>Next: Matching passages
Next-->>Vapi: Context
Vapi-->>User: Spoken answer
```
Overview
BookBy is an AI book companion for a faster, more interactive way to understand long-form reading material.
Instead of treating a PDF as static text, the app:
- Authenticates users with Better Auth (email/password,
user/adminroles) - Stores owned books in PostgreSQL (Prisma) and PDFs in Vercel Blob
- Opens the voice chat page as soon as upload finishes; segment indexing continues in the background
- Provides a dashboard with KPIs, Recharts analytics, continue-reading, voice history, and notifications
- Lets you browse a warm literary library (parchment light / charcoal dark)
- Runs Vapi-powered voice sessions so you can ask questions out loud
- Keeps session duration and transcripts for revisit
Features
| #### Ingestion - PDF upload with staged progress UI - Immediate redirect to the book voice page - Background text extraction and segmentation - Optional free-text categories - Selectable assistant voices (persona) #### Library & ownership - Per-user library (owner-scoped books) - Title / author / category search - Edit and delete your own titles - Unique slug per user | #### Voice & AI - Live voice Q&A through Vapi - Segment search tool for grounded answers - Session transcripts and duration tracking - Reading history recorded on open #### Product shell - Marketing landing (GSAP + Framer Motion) - Authenticated shell (sidebar, topbar, breadcrumbs) - Dashboard analytics (per-chart time ranges) - Notifications (upload, PDF processed, voice session) - Settings (profile, password, theme) - Admin book list for emails in `ADMIN_EMAILS` - Literary light and dark themes |
How It Works
Step 1 — Create an account
Sign up at /sign-up, then sign in. New sessions land on the dashboard.
Step 2 — Upload a PDF
Add a book from /books/new. After the PDF is stored and the book row is created, BookBy opens the chat page right away. Text indexing for voice search finishes in the background (you get a notification when it is ready).
Step 3 — Voice chat
On /books/[slug], start a Vapi session. Ask questions, request summaries, and explore ideas at conversation speed.
Step 4 — Revisit
Return to the dashboard or library: continue reading, scroll recent books, check voice sessions and notifications, and switch theme in settings.
Admin
Add your email to ADMIN_EMAILS in .env (role is set on new sign-up). Existing users need role = admin in the database, then sign out and back in. Open /admin or use the Admin item in the sidebar.
Tech Stack
| Layer | Tools |
|---|---|
| App | Next.js 16, React 19, TypeScript |
| Auth | Better Auth (email/password, user \ |
| UI | Tailwind CSS v4, shadcn/ui, GSAP, Framer Motion, Recharts |
| Data | PostgreSQL, Prisma |
| Voice | Vapi |
| Media | Vercel Blob |
Project Structure
AIBookAssistant/
├── app/
│ ├── (root)/page.tsx # Marketing landing
│ ├── (app)/ # Authenticated shell
│ │ ├── dashboard/
│ │ ├── library/
│ │ ├── books/new/
│ │ ├── settings/
│ │ ├── notifications/
│ │ └── admin/
│ ├── books/[slug]/page.tsx # Voice chat page
│ ├── sign-in/ · sign-up/
│ ├── api/ # Auth, upload, Vapi routes
│ ├── globals.css
│ └── layout.tsx
├── components/
│ ├── landing/ # Landing sections
│ ├── shell/ # Sidebar, topbar, notifications
│ ├── dashboard/ · charts/
│ ├── UploadForm.tsx
│ ├── VapiControls.tsx
│ └── ...
├── lib/ # Auth, actions, analytics, DB, utils
├── prisma/ # Schema + migrations
├── public/assets/
└── package.json
First-Time Setup
1. Clone repository
git clone <your-repo-url>
cd AIBookAssistant
2. Install dependencies
npm install
3. Environment
Create a .env file in the project root:
NODE_ENV=development
NEXT_PUBLIC_BASE_URL=http://localhost:3000
DATABASE_URL=postgresql://postgres:bookby_dev@localhost:5433/bookby
# Better Auth — generate secret with: npx auth secret
BETTER_AUTH_SECRET=
BETTER_AUTH_URL=http://localhost:3000
# Comma-separated emails that receive the admin role on sign-up
ADMIN_EMAILS=
BLOB_READ_WRITE_TOKEN=
NEXT_PUBLIC_VAPI_API_KEY=
VAPI_SERVER_SECRET=
NEXT_PUBLIC_ASSISTANT_ID=
4. Database
Prerequisites: Node.js 18+, npm, PostgreSQL (Docker container bookby-pg on host port 5433, or any Postgres you manage).
docker start bookby-pg
npx prisma migrate deploy
Run The Application
npm run dev
Then open http://localhost:3000.
| Route | Description |
|---|---|
/ |
Marketing landing (public) |
/sign-up · /sign-in |
Create account / sign in |
/dashboard |
Analytics home (authenticated) |
/library |
Your books |
/books/new |
Upload a PDF |
/books/[slug] |
Voice companion for a book |
/settings |
Profile, password, and theme |
/notifications |
Activity feed |
/admin |
All books across users (admins only) |
Notes
- The repository and package name are BookBy.
- Authentication uses Better Auth (self-hosted) with email/password and a
user|adminrole. - Books are owner-scoped; each user only sees and manages their own library (admins can list all books).
- PDF text indexing runs after you enter chat so upload feels fast; voice search works once indexing finishes.
Author
Mohammad Bilal
Software Engineering Student
AI + Full Stack Developer
License
This project is licensed under the MIT License.
Support
If you liked this project:
- Star the repository
- Fork the project
- Contribute improvements
**[Back to top](#at-a-glance)**
BookBy · Next.js · TypeScript · Tailwind · PostgreSQL · Prisma · Better Auth · Vapi
Log in or sign up for Devpost to join the conversation.