Skip to content

Nishantgoyal918/readscribe

Repository files navigation

ReadScribe - Local Knowledge Base

A Chrome extension and Next.js web app for reading, summarizing, and querying web content using local LLM (Ollama) and RAG. Built entirely with TypeScript and LangChain.js.

Features

  • Chrome Extension: Capture and scrape webpages
  • Local LLM Integration: Uses Ollama for summarization and chat
  • Knowledge Base: Stores scraped content in local SQLite database
  • RAG System: Semantic search and retrieval using LangChain.js
  • Local Chat Interface: Accessible over local network (including mobile devices)
  • Full TypeScript: Entire stack built with TypeScript/Next.js

Project Structure

readscribe/
├── app/                  # Next.js application (API routes + frontend)
│   ├── app/             # Next.js app router
│   │   ├── api/        # API routes
│   │   └── page.tsx    # Chat UI
│   └── lib/            # Shared utilities
├── chrome-extension/   # Chrome extension (React/TypeScript)
└── shared/             # Shared types and utilities

Prerequisites

  1. Node.js 18+ - Download
  2. Ollama - Download

Setup

Step 1: Install Ollama and Models

# Install Ollama from https://ollama.ai/
# Then pull required models:
ollama pull llama3.2
ollama pull nomic-embed-text

Step 2: Setup Next.js App

cd app

# Install dependencies
npm install

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

# Edit .env.local if needed (defaults should work)

Step 3: Start the Application

# Start Next.js dev server (accessible from local network)
npm run dev -- -H 0.0.0.0

The app will run on http://localhost:3000 (accessible from your local network at http://YOUR_IP:3000)

Step 4: Chrome Extension Setup

cd chrome-extension

# Install dependencies
npm install

# Build the extension
npm run build

Then in Chrome:

  1. Open chrome://extensions/
  2. Enable "Developer mode" (toggle in top right)
  3. Click "Load unpacked"
  4. Select the chrome-extension/dist folder

Usage

  1. Capture Pages: Browse the web and click the extension icon, then click "Capture & Summarize Page"
  2. Chat: Open http://localhost:3000 (or your local IP) and ask questions about your reading
  3. Access from Phone: Use your computer's local IP address (e.g., http://192.168.1.100:3000) to access the chat from your phone on the same network
  4. Telegram Bot (optional): Send links to your Telegram bot and it will ingest them into the same database

Technology Stack

  • Next.js 16 - Full-stack React framework
  • TypeScript - Type-safe development
  • LangChain.js - LLM orchestration and RAG
  • Ollama - Local LLM inference
  • SQLite (better-sqlite3) - Local database
  • Cheerio - Web scraping
  • Tailwind CSS - Styling

API Endpoints

  • POST /api/scrape - Scrape and summarize a webpage
  • POST /api/chat - Chat with RAG-powered responses
  • GET /api/pages - Get all scraped pages
  • GET /api/pages/[id] - Get a specific page
  • GET/POST /api/config - View/update local configuration (Ollama + Telegram)

Configuration

Edit app/.env.local to customize:

  • Ollama base URL
  • Model names
  • Other settings

Telegram bot

  • Create a bot via BotFather and get a token
  • Open http://localhost:3000/config and set:
    • Bot Token
    • Allowed Chat IDs (optional)
  • Run the bot worker:
cd app
npm run telegram:bot

Troubleshooting

Next.js won't start

  • Make sure Ollama is running: ollama list
  • Check if port 3000 is available
  • Verify Node.js dependencies are installed

Extension doesn't work

  • Check browser console for errors
  • Verify Next.js app is running on port 3000
  • Check manifest.json host_permissions match your Next.js URL

RAG not working

  • Ensure nomic-embed-text model is installed: ollama pull nomic-embed-text
  • Check Next.js server logs for embedding errors
  • Verify database has pages with embeddings stored

Can't access from phone

  • Make sure Next.js is running with -H 0.0.0.0 flag
  • Verify phone and computer are on the same WiFi network
  • Check firewall settings on your computer

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors