Skip to content

A tool that converts books (PDF, EPUB, or plain text) into structured summaries with interactive chat.

Notifications You must be signed in to change notification settings

balewgize/reading-assistant

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

43 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Reading Assistant

An AI-powered tool that converts books (PDF, EPUB, or plain text) into structured summaries, and interactive chat.

The goal is to help busy readers extract core ideas of a book quickly, without needing to read it cover to cover.


Features

  • Multi-format input (PDF, EPUB, plain text)
  • Structured summary (core thesis, key insights, actionable takeaways, who it’s for)
  • Chapter-by-chapter summaries
  • Chat with the book content
  • Export summaries to PDF
  • Caching to avoid re-processing identical content

Tech Stack

Backend

  • Language: Python 3.12
  • Framework: FastAPI
  • ORM: SQLAlchemy
  • Database: SQLite (default), configurable to PostgreSQL
  • Vector Store: ChromaDB (for RAG)

Frontend

  • Framework: Next.js 16 (App Router)
  • UI: React 19 + TypeScript + Tailwind CSS
  • Auth: Better Auth

AI & Infra

  • LLM: OpenRouter API (Gemini 3 Flash)
  • Embeddings: OpenAI embeddings (for RAG)
  • RAG: LlamaIndex

Installation

Prerequisites

  • Python 3.12+
  • Node.js 24+
  • uv Python package manager

Backend setup

python -m venv venv
source venv/bin/activate  # Windows: venv\Scripts\activate

uv pip install -r requirements.txt

cp .env.example .env
# Edit .env with your API keys and settings

Frontend setup

cd client
npm install

cp .env.local.example .env.local
# Edit environment variables

Auth database (required)

Better Auth requires a Postgres database:

  1. Create a Postgres instance (e.g. via Neon)
  2. Set DATABASE_URL in client/.env.local
  3. Run migrations:
npx drizzle-kit push

Running locally

# Backend
uvicorn api:app --reload --host 0.0.0.0 --port 8000

# Frontend
cd client
npm run dev

Open: http://localhost:3000


API Overview

  • POST /api/summarize – Upload a book or text and generate a summary
  • GET /api/summary/{id} – Retrieve a summary
  • GET /api/summary/{id}/pdf – Download summary as PDF
  • POST /api/summary/{id}/save – Save summary to user library
  • GET /api/library – List saved summaries
  • POST /api/chat – Chat with a summarized book (RAG)

Environment Variables

Backend (.env)

OPENROUTER_API_KEY=your_openrouter_key
OPENAI_API_KEY=your_openai_key
LLM_MODEL=google/gemini-3-flash-preview
DATABASE_URL=sqlite:///data/app.db
BETTER_AUTH_URL=http://localhost:3000
LOG_LEVEL=INFO

Frontend (client/.env.local)

NEXT_PUBLIC_API_URL=http://localhost:8000

Project Structure

├── api.py                 # FastAPI entrypoint
├── core/                  # Core business logic
│   ├── config.py
│   ├── extractor.py       # PDF / EPUB text extraction
│   ├── summarizer.py      # LLM summarization logic
│   ├── auth.py            # Auth helpers
│   └── pdf_export.py      # PDF generation
├── db/
│   ├── models/            # SQLAlchemy models
│   └── repositories/      # Data access layer
├── routers/               # API route definitions
├── rag/                   # RAG pipeline
├── client/                # Next.js frontend
│   ├── app/
│   ├── components/
│   └── lib/
├── requirements.txt
└── data/                  # SQLite DB + Chroma vectors

Contributing

Contributions are welcome! Please open an issue or submit a pull request.


License

MIT

About

A tool that converts books (PDF, EPUB, or plain text) into structured summaries with interactive chat.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published