The Reader.Market application features a new redesigned landing page at the root path (https://reader.market/) with the following features:
- Clear explanation that users upload their own books (not a bookstore)
- Highlights AI-powered features (summaries, insights, recommendations)
- Focus on helping users understand and remember their books
- SEO-optimized with proper meta tags and static rendering
/- New main landing page with AI-focused messaging/landing- Old landing page preserved for continued access/earlyor/?early=1- Early adopter version with alternative messaging
A sophisticated ebook reader application that combines modern web technologies with AI-powered analysis capabilities. The application allows users to upload, read, organize, and analyze ebooks with the help of Ollama AI integration!
- Features
- Technology Stack
- Architecture
- Project Structure
- Installation
- Configuration
- Usage
- Development
- API Documentation
- Database Schema
- Deployment
- Troubleshooting
- Contributing
- License
- Multi-format Ebook Support: Read EPUB, MOBI, AZW3, FB2, CBZ, and experimental PDF formats
- AI-Powered Analysis: Intelligent content summarization, key point extraction, and term explanation using Ollama
- Personal Bookshelves: Organize books into custom collections with color coding
- Advanced Reading Experience:
- Professional-grade ebook rendering with Foliate.js
- Adjustable font size, line spacing, and themes
- Paginated and scrolled view modes
- Progress tracking and bookmark management
- Social Features: Book reviews, comments, and reactions
- Reading Statistics: Track reading time, words read, and books completed
- Responsive Design: Works on desktop and mobile devices
- Node.js - JavaScript runtime environment
- Express - Web application framework
- PostgreSQL - Relational database management system
- Drizzle ORM - TypeScript ORM for database operations
- Ollama - Local AI model runner
- TypeScript - Typed superset of JavaScript
- React 19 - User interface library
- Foliate.js - Professional ebook rendering engine
- Tailwind CSS - Utility-first CSS framework
- TanStack Query - Server state management
- Lucide React - Icon library
- Radix UI - Accessible UI components
- Wouter - React router
- Vite - Fast build tool
- Docker - Containerization platform
- PM2 - Production process manager
- Nginx - Web server and reverse proxy
- Let's Encrypt - SSL certificate management
The application follows a layered architecture pattern with clear separation of concerns:
┌─────────────────────────────────────────────────────────┐
│ Frontend Layer │
├─────────────────────────────────────────────────────────┤
│ React Components │ UI Components │ State Management │
│ (BookReader, │ (Radix UI, │ (TanStack Query) │
│ Library, etc.) │ Tailwind) │ │
└─────────────────────────────────────────────────────────┘
│
▼
┌─────────────────────────────────────────────────────────┐
│ Service Layer │
├─────────────────────────────────────────────────────────┤
│ Reader Service │ AI Analysis │ API Client │
│ (Foliate.js │ Adapter │ (Axios) │
│ integration) │ (Ollama) │ │
└─────────────────────────────────────────────────────────┘
│
▼
┌─────────────────────────────────────────────────────────┐
│ Backend Layer │
├─────────────────────────────────────────────────────────┤
│ Express Server │ Authentication │ Middleware │
│ (API Routes) │ (Passport) │ (CORS, etc.) │
└─────────────────────────────────────────────────────────┘
│
▼
┌─────────────────────────────────────────────────────────┐
│ Data Layer │
├─────────────────────────────────────────────────────────┤
│ PostgreSQL DB │ Drizzle ORM │ Migrations │
└─────────────────────────────────────────────────────────┘
- EnhancedBookReader: The main ebook reader component using Foliate.js for rendering
- ReaderService: Abstraction layer between React components and Foliate.js
- AIAnalysisAdapter: Integration layer for Ollama AI features
- Authentication System: Complete user registration and login system
- Book Management: Upload, storage, and retrieval of ebook files
Ollama-Reader/
├── client/ # Frontend React application
│ ├── src/
│ │ ├── components/ # Reusable UI components
│ │ │ ├── ebook-reader/ # Ebook reader specific components
│ │ │ ├── ui/ # Radix UI components
│ │ │ └── ... # Other components
│ │ ├── pages/ # Route components
│ │ ├── hooks/ # Custom React hooks
│ │ ├── lib/ # Utility functions and services
│ │ └── App.tsx # Main application component
│ ├── index.html
│ └── tsconfig.json
├── server/ # Backend Express server
│ ├── index.ts # Main server entry point
│ ├── routes.ts # API route definitions
│ ├── static.ts # Static file serving
│ ├── storage.ts # File storage logic
│ └── vite.ts # Vite integration
├── shared/ # Shared code between frontend and backend
│ ├── schema.ts # Database schema definitions
│ └── ... # Shared types and utilities
├── migrations/ # Database migration files
├── uploads/ # User uploaded ebook files
├── screenshots/ # Project screenshots
├── script/ # Build scripts
├── .env # Environment variables
├── .gitignore
├── package.json
├── DATABASE_SETUP.md # Database setup instructions
├── DEPLOYMENT_INSTRUCTIONS.md # Production deployment guide
├── LOCAL_SETUP.md # Local development setup
├── INTEGRATION_SUMMARY.md # Integration documentation
└── ...
- Node.js (version 16 or higher)
- Docker (for PostgreSQL database)
- Git
- Ollama (for AI features)
-
Clone the repository
git clone <repository-url> cd Ollama-Reader
-
Install dependencies
npm install
-
Set up PostgreSQL database
# Start PostgreSQL container docker run -d --name postgres-db \ -e POSTGRES_PASSWORD=bookspassword \ -e POSTGRES_USER=booksuser \ -e POSTGRES_DB=booksdb \ -p 5432:5432 \ postgres:16 -
Configure environment variables
Create a
.envfile in the project root:DATABASE_URL=postgresql://booksuser:bookspassword@localhost:5432/booksdb?schema=public PORT=3000 -
Run database migrations
npm run db:push
-
Start the development servers
In separate terminals:
# Backend server npm run dev# Frontend development server npm run dev:client -
Access the application
- Frontend:
http://localhost:5000 - Backend API:
http://localhost:3000/api
- Frontend:
| Variable | Description | Default |
|---|---|---|
DATABASE_URL |
PostgreSQL database connection string | - |
PORT |
Backend server port | 3000 |
OLLAMA_HOST |
Ollama API host | http://localhost:11434 |
The application uses PostgreSQL with the following tables:
users- User account informationbooks- Ebook metadata and file informationshelves- User-created bookshelvesshelf_books- Junction table for shelves and booksreading_progress- Track reading progress for booksreading_statistics- Detailed reading statistics per bookuser_statistics- Overall user reading statisticsbookmarks- User-created bookmarkscomments- Book commentsreviews- Book reviews and ratingsreactions- Likes and reactions to comments/reviews
- Navigate to
/registerto create an account - Use
/loginto sign in with your credentials - Your session will be maintained with JWT tokens
- Go to
/add-bookto upload new ebooks - Supported formats: EPUB, MOBI, AZW3, FB2, CBZ (PDF experimental)
- Books will appear in your library after upload
- Access your library at
/or browse books - Click on a book to view details at
/book/:bookId - Use
/read/:bookId/:chapterIdto open the ebook reader - Adjust reading settings using the controls in the reader
- Create bookmarks and access AI analysis features
- Visit
/shelvesto view your book collections - Create new shelves to organize your books
- Add books to shelves for better organization
The application integrates with Ollama AI models to provide:
- Content Summarization: Get AI-generated summaries of chapters or sections
- Key Point Extraction: Identify important concepts and ideas
- Term Explanation: Understand complex terms in context
- Smart Chapter Summaries: AI-powered chapter overviews
| Script | Description |
|---|---|
npm run dev |
Start the backend development server |
npm run dev:client |
Start the frontend development server |
npm run build |
Build the application for production |
npm run start |
Start the production server |
npm run db:push |
Push database schema changes |
npm run check |
Type-check the codebase |
- Make changes to the codebase
- The frontend will automatically reload in development mode
- For backend changes, restart the development server
- Write tests for new features
- Run type checks before committing:
npm run check
- Frontend: React components following modern best practices
- Backend: Express API with clean separation of routes and business logic
- Database: Drizzle ORM with TypeScript schemas
- Shared: Types and utilities used by both frontend and backend
The application provides a RESTful API for managing books, users, and reading features.
Most endpoints require authentication using JWT tokens:
Authorization: Bearer <token>
POST /api/auth/register- User registrationPOST /api/auth/login- User loginPOST /api/auth/logout- User logout
GET /api/books- Get all booksGET /api/books/:id- Get book by IDPOST /api/books- Upload new bookDELETE /api/books/:id- Delete book
GET /api/shelves- Get user shelvesPOST /api/shelves- Create new shelfPUT /api/shelves/:id- Update shelfDELETE /api/shelves/:id- Delete shelf
GET /api/progress/:bookId- Get reading progressPOST /api/progress/:bookId- Update reading progressGET /api/bookmarks/:bookId- Get bookmarks for a book
GET /api/books/:bookId/reviews- Get book reviewsPOST /api/books/:bookId/reviews- Add book reviewGET /api/books/:bookId/comments- Get book commentsPOST /api/books/:bookId/comments- Add book comment
The application uses PostgreSQL with the following schema:
Stores user account information with authentication details.
Manages ebook metadata including title, author, file path, and user associations.
Contains user-created book collections for organizing books.
reading_progress- Tracks current reading position for each user-book combinationreading_statistics- Detailed statistics about reading activityuser_statistics- Overall reading statistics per user
bookmarks- User-created bookmarkscomments- Book commentsreviews- Book reviews with ratingsreactions- Likes and reactions to content
For production deployment, refer to the DEPLOYMENT_INSTRUCTIONS.md file which includes:
- Server preparation and security configuration
- Automated deployment script usage
- SSL certificate setup with Let's Encrypt
- PM2 process management
- Nginx reverse proxy configuration
- Database backup and recovery procedures
- Ensure sufficient server resources for ebook storage and processing
- Configure Ollama models for production use
- Set up proper SSL certificates for secure communication
- Configure backup strategies for database and uploaded files
-
Port Conflicts
- Check if ports 3000 (backend) and 5000 (frontend) are available
- Modify ports in
.envand configuration files if needed
-
Database Connection Issues
- Verify PostgreSQL container is running:
docker ps - Check credentials in
.envmatch Docker container settings - Ensure port 5432 is not blocked by firewall
- Verify PostgreSQL container is running:
-
Ollama Integration Issues
- Verify Ollama is running:
curl http://localhost:11434 - Check that required models are pulled:
ollama pull <model-name>
- Verify Ollama is running:
-
File Upload Issues
- Ensure upload directory has proper write permissions
- Check file size limits in configuration
- On Windows, ensure
cross-envis properly handling environment variables - If experiencing issues with Foliate.js, verify it's properly installed and accessible
- Check browser console for client-side errors
- Monitor server logs for backend issues
- Fork the repository
- Create a feature branch:
git checkout -b feature-name - Make your changes
- Commit your changes:
git commit -m 'Add some feature' - Push to the branch:
git push origin feature-name - Submit a pull request
- Follow TypeScript best practices
- Write clear, descriptive commit messages
- Include tests for new functionality
- Update documentation as needed
- Follow existing code style and patterns
This project is licensed under the MIT License - see the LICENSE file for details.# Ollama-Reader
A sophisticated ebook reader application that combines modern web technologies with AI-powered analysis capabilities. The application allows users to upload, read, organize, and analyze ebooks with the help of Ollama AI integration.
- Features
- Technology Stack
- Architecture
- Project Structure
- Installation
- Configuration
- Usage
- Development
- API Documentation
- Database Schema
- Deployment
- Troubleshooting
- Contributing
- License
- Multi-format Ebook Support: Read EPUB, MOBI, AZW3, FB2, CBZ, and experimental PDF formats
- AI-Powered Analysis: Intelligent content summarization, key point extraction, and term explanation using Ollama
- Personal Bookshelves: Organize books into custom collections with color coding
- Advanced Reading Experience:
- Professional-grade ebook rendering with Foliate.js
- Adjustable font size, line spacing, and themes
- Paginated and scrolled view modes
- Progress tracking and bookmark management
- Social Features: Book reviews, comments, and reactions
- Reading Statistics: Track reading time, words read, and books completed
- Responsive Design: Works on desktop and mobile devices
- Node.js - JavaScript runtime environment
- Express - Web application framework
- PostgreSQL - Relational database management system
- Drizzle ORM - TypeScript ORM for database operations
- Ollama - Local AI model runner
- TypeScript - Typed superset of JavaScript
- React 19 - User interface library
- Foliate.js - Professional ebook rendering engine
- Tailwind CSS - Utility-first CSS framework
- TanStack Query - Server state management
- Lucide React - Icon library
- Radix UI - Accessible UI components
- Wouter - React router
- Vite - Fast build tool
- Docker - Containerization platform
- PM2 - Production process manager
- Nginx - Web server and reverse proxy
- Let's Encrypt - SSL certificate management
The application follows a layered architecture pattern with clear separation of concerns:
┌─────────────────────────────────────────────────────────┐
│ Frontend Layer │
├─────────────────────────────────────────────────────────┤
│ React Components │ UI Components │ State Management │
│ (BookReader, │ (Radix UI, │ (TanStack Query) │
│ Library, etc.) │ Tailwind) │ │
└─────────────────────────────────────────────────────────┘
│
▼
┌─────────────────────────────────────────────────────────┐
│ Service Layer │
├─────────────────────────────────────────────────────────┤
│ Reader Service │ AI Analysis │ API Client │
│ (Foliate.js │ Adapter │ (Axios) │
│ integration) │ (Ollama) │ │
└─────────────────────────────────────────────────────────┘
│
▼
┌─────────────────────────────────────────────────────────┐
│ Backend Layer │
├─────────────────────────────────────────────────────────┤
│ Express Server │ Authentication │ Middleware │
│ (API Routes) │ (Passport) │ (CORS, etc.) │
└─────────────────────────────────────────────────────────┘
│
▼
┌─────────────────────────────────────────────────────────┐
│ Data Layer │
├─────────────────────────────────────────────────────────┤
│ PostgreSQL DB │ Drizzle ORM │ Migrations │
└─────────────────────────────────────────────────────────┘
- EnhancedBookReader: The main ebook reader component using Foliate.js for rendering
- ReaderService: Abstraction layer between React components and Foliate.js
- AIAnalysisAdapter: Integration layer for Ollama AI features
- Authentication System: Complete user registration and login system
- Book Management: Upload, storage, and retrieval of ebook files
Ollama-Reader/
├── client/ # Frontend React application
│ ├── src/
│ │ ├── components/ # Reusable UI components
│ │ │ ├── ebook-reader/ # Ebook reader specific components
│ │ │ ├── ui/ # Radix UI components
│ │ │ └── ... # Other components
│ │ ├── pages/ # Route components
│ │ ├── hooks/ # Custom React hooks
│ │ ├── lib/ # Utility functions and services
│ │ └── App.tsx # Main application component
│ ├── index.html
│ └── tsconfig.json
├── server/ # Backend Express server
│ ├── index.ts # Main server entry point
│ ├── routes.ts # API route definitions
│ ├── static.ts # Static file serving
│ ├── storage.ts # File storage logic
│ └── vite.ts # Vite integration
├── shared/ # Shared code between frontend and backend
│ ├── schema.ts # Database schema definitions
│ └── ... # Shared types and utilities
├── migrations/ # Database migration files
├── uploads/ # User uploaded ebook files
├── screenshots/ # Project screenshots
├── script/ # Build scripts
├── .env # Environment variables
├── .gitignore
├── package.json
├── DATABASE_SETUP.md # Database setup instructions
├── DEPLOYMENT_INSTRUCTIONS.md # Production deployment guide
├── LOCAL_SETUP.md # Local development setup
├── INTEGRATION_SUMMARY.md # Integration documentation
└── ...
- Node.js (version 16 or higher)
- Docker (for PostgreSQL database)
- Git
- Ollama (for AI features)
-
Clone the repository
git clone <repository-url> cd Ollama-Reader
-
Install dependencies
npm install
-
Set up PostgreSQL database
# Start PostgreSQL container docker run -d --name postgres-db \ -e POSTGRES_PASSWORD=bookspassword \ -e POSTGRES_USER=booksuser \ -e POSTGRES_DB=booksdb \ -p 5432:5432 \ postgres:16 -
Configure environment variables
Create a
.envfile in the project root:DATABASE_URL=postgresql://booksuser:bookspassword@localhost:5432/booksdb?schema=public PORT=3000 -
Run database migrations
npm run db:push
-
Start the development servers
In separate terminals:
# Backend server npm run dev# Frontend development server npm run dev:client -
Access the application
- Frontend:
http://localhost:5000 - Backend API:
http://localhost:3000/api
- Frontend:
| Variable | Description | Default |
|---|---|---|
DATABASE_URL |
PostgreSQL database connection string | - |
PORT |
Backend server port | 3000 |
OLLAMA_HOST |
Ollama API host | http://localhost:11434 |
The application uses PostgreSQL with the following tables:
users- User account informationbooks- Ebook metadata and file informationshelves- User-created bookshelvesshelf_books- Junction table for shelves and booksreading_progress- Track reading progress for booksreading_statistics- Detailed reading statistics per bookuser_statistics- Overall user reading statisticsbookmarks- User-created bookmarkscomments- Book commentsreviews- Book reviews and ratingsreactions- Likes and reactions to comments/reviews
- Navigate to
/registerto create an account - Use
/loginto sign in with your credentials - Your session will be maintained with JWT tokens
- Go to
/add-bookto upload new ebooks - Supported formats: EPUB, MOBI, AZW3, FB2, CBZ (PDF experimental)
- Books will appear in your library after upload
- Access your library at
/or browse books - Click on a book to view details at
/book/:bookId - Use
/read/:bookId/:chapterIdto open the ebook reader - Adjust reading settings using the controls in the reader
- Create bookmarks and access AI analysis features
- Visit
/shelvesto view your book collections - Create new shelves to organize your books
- Add books to shelves for better organization
The application integrates with Ollama AI models to provide:
- Content Summarization: Get AI-generated summaries of chapters or sections
- Key Point Extraction: Identify important concepts and ideas
- Term Explanation: Understand complex terms in context
- Smart Chapter Summaries: AI-powered chapter overviews
| Script | Description |
|---|---|
npm run dev |
Start the backend development server |
npm run dev:client |
Start the frontend development server |
npm run build |
Build the application for production |
npm run start |
Start the production server |
npm run db:push |
Push database schema changes |
npm run check |
Type-check the codebase |
- Make changes to the codebase
- The frontend will automatically reload in development mode
- For backend changes, restart the development server
- Write tests for new features
- Run type checks before committing:
npm run check
- Frontend: React components following modern best practices
- Backend: Express API with clean separation of routes and business logic
- Database: Drizzle ORM with TypeScript schemas
- Shared: Types and utilities used by both frontend and backend
The application provides a RESTful API for managing books, users, and reading features.
Most endpoints require authentication using JWT tokens:
Authorization: Bearer <token>
POST /api/auth/register- User registrationPOST /api/auth/login- User loginPOST /api/auth/logout- User logout
GET /api/books- Get all booksGET /api/books/:id- Get book by IDPOST /api/books- Upload new bookDELETE /api/books/:id- Delete book
GET /api/shelves- Get user shelvesPOST /api/shelves- Create new shelfPUT /api/shelves/:id- Update shelfDELETE /api/shelves/:id- Delete shelf
GET /api/progress/:bookId- Get reading progressPOST /api/progress/:bookId- Update reading progressGET /api/bookmarks/:bookId- Get bookmarks for a book
GET /api/books/:bookId/reviews- Get book reviewsPOST /api/books/:bookId/reviews- Add book reviewGET /api/books/:bookId/comments- Get book commentsPOST /api/books/:bookId/comments- Add book comment
The application uses PostgreSQL with the following schema:
Stores user account information with authentication details.
Manages ebook metadata including title, author, file path, and user associations.
Contains user-created book collections for organizing books.
reading_progress- Tracks current reading position for each user-book combinationreading_statistics- Detailed statistics about reading activityuser_statistics- Overall reading statistics per user
bookmarks- User-created bookmarkscomments- Book commentsreviews- Book reviews with ratingsreactions- Likes and reactions to content
For production deployment, refer to the DEPLOYMENT_INSTRUCTIONS.md file which includes:
- Server preparation and security configuration
- Automated deployment script usage
- SSL certificate setup with Let's Encrypt
- PM2 process management
- Nginx reverse proxy configuration
- Database backup and recovery procedures
- Ensure sufficient server resources for ebook storage and processing
- Configure Ollama models for production use
- Set up proper SSL certificates for secure communication
- Configure backup strategies for database and uploaded files
-
Port Conflicts
- Check if ports 3000 (backend) and 5000 (frontend) are available
- Modify ports in
.envand configuration files if needed
-
Database Connection Issues
- Verify PostgreSQL container is running:
docker ps - Check credentials in
.envmatch Docker container settings - Ensure port 5432 is not blocked by firewall
- Verify PostgreSQL container is running:
-
Ollama Integration Issues
- Verify Ollama is running:
curl http://localhost:11434 - Check that required models are pulled:
ollama pull <model-name>
- Verify Ollama is running:
-
File Upload Issues
- Ensure upload directory has proper write permissions
- Check file size limits in configuration
- On Windows, ensure
cross-envis properly handling environment variables - If experiencing issues with Foliate.js, verify it's properly installed and accessible
- Check browser console for client-side errors
- Monitor server logs for backend issues
- Fork the repository
- Create a feature branch:
git checkout -b feature-name - Make your changes
- Commit your changes:
git commit -m 'Add some feature' - Push to the branch:
git push origin feature-name - Submit a pull request
- Follow TypeScript best practices
- Write clear, descriptive commit messages
- Include tests for new functionality
- Update documentation as needed
- Follow existing code style and patterns
This project is licensed under the MIT License - see the LICENSE file for details.