Skip to content

CozyRunner/ebook-reader

Repository files navigation

πŸ“š Ebook Reader

A minimal, fast, and distraction-free ebook reader built with Flutter, designed for language learners, students, and knowledge workers.

Core differentiator: Instant dictionary lookup + inline notes while reading β€” making it a blend of Kindle, language learning, and research notes.


✨ Features

πŸ“– Reader

  • EPUB & PDF support via epub_view and syncfusion_flutter_pdfviewer
  • Reader themes: Light, Dark, and Sepia
  • Adjustable font size for comfortable reading
  • Reading progress bar with position memory (resume where you left off)
  • Smooth scrolling with iOS-style bouncing physics
  • Chapter navigator sidebar with auto-hide (slide-in TOC for EPUBs, page navigator for PDFs)

πŸ“š Library

  • Grid view of all uploaded books with cover images
  • Sort by recently read
  • Upload EPUB/PDF files directly from your device
  • Custom book covers via image picker
  • Progress indicator on each book

πŸ“ Notes

  • Add notes directly from the reader via the AppBar
  • Notes are linked to specific books
  • View, edit, and delete all notes from the dedicated Notes tab
  • Synced to Firestore in real-time

πŸ” Dictionary

  • Tap a word in the PDF reader to instantly look up its definition
  • Uses the free Dictionary API
  • Save words to your vocabulary list directly from the popup

πŸ”¦ Highlights

  • Highlight text passages with color options (Yellow, Green, Blue)
  • Highlights saved to Firestore per book

πŸ““ Vocabulary Builder

  • Automatically saves words you look up
  • Review your vocabulary list in a dedicated tab
  • Each word is linked back to the book it was found in

πŸ—οΈ Architecture

Flutter Android App
       β”‚
Firebase Services
 β”œβ”€ Firebase Storage  β†’ store ebook files
 β”œβ”€ Firestore         β†’ metadata, notes, highlights, vocabulary
 └─ Firebase Auth     β†’ user authentication

Project Structure

lib/
β”œβ”€β”€ core/
β”‚   └── theme/            # App themes & reader themes
β”‚
β”œβ”€β”€ models/
β”‚   β”œβ”€β”€ book.dart         # Book metadata model
β”‚   β”œβ”€β”€ note.dart         # Note model
β”‚   β”œβ”€β”€ highlight.dart    # Highlight model
β”‚   └── vocabulary.dart   # Vocabulary word model
β”‚
β”œβ”€β”€ services/
β”‚   β”œβ”€β”€ firebase_service.dart     # Firestore & Storage CRUD
β”‚   β”œβ”€β”€ auth_service.dart         # Firebase Authentication
β”‚   β”œβ”€β”€ cache_service.dart        # Local file caching
β”‚   └── dictionary_service.dart   # Dictionary API lookups
β”‚
β”œβ”€β”€ features/
β”‚   β”œβ”€β”€ auth/             # Login & registration screens
β”‚   β”œβ”€β”€ library/          # Book grid, upload, providers
β”‚   β”œβ”€β”€ reader/           # EPUB & PDF reader screens
β”‚   β”‚   β”œβ”€β”€ epub_reader_screen.dart
β”‚   β”‚   β”œβ”€β”€ pdf_reader_screen.dart
β”‚   β”‚   β”œβ”€β”€ reader_settings.dart
β”‚   β”‚   β”œβ”€β”€ add_note_sheet.dart
β”‚   β”‚   └── chapter_sidebar.dart
β”‚   β”œβ”€β”€ dictionary/       # Word lookup popup
β”‚   β”œβ”€β”€ notes/            # Notes list screen
β”‚   β”œβ”€β”€ vocabulary/       # Vocabulary list screen
β”‚   └── settings/         # App settings
β”‚
└── main.dart

State Management

  • Riverpod (flutter_riverpod) β€” lightweight, compile-safe, and reactive

πŸ”₯ Firebase Setup

Firestore Database

Database ID: ebook-reader
Edition: Standard
Location: nam5
Mode: Native

Collections

Collection Purpose
books Book metadata & reading progress
notes User notes per book
highlights Text highlights per book
vocabulary Saved dictionary lookups

Required Composite Indexes

Firestore requires composite indexes for queries that filter and sort on different fields. Create these indexes via the Firebase Console (Firestore will provide direct links in the debug console if they're missing):

Collection Fields
books user_id (Asc) + last_read (Desc)
notes user_id (Asc) + created_at (Desc)
vocabulary user_id (Asc) + created_at (Desc)

Storage

ebooks/
  └── {user_id}/
        β”œβ”€β”€ {book_id}.epub
        β”œβ”€β”€ {book_id}.pdf
        └── {book_id}_cover.jpg

Security Rules (Development)

rules_version = '2';
service cloud.firestore {
  match /databases/{database}/documents {
    match /{document=**} {
      allow read, write: if request.auth != null;
    }
  }
}

πŸ“¦ Dependencies

Core

Package Purpose
flutter_riverpod State management
firebase_core Firebase initialization
cloud_firestore Database
firebase_storage File storage
firebase_auth Authentication

Reader

Package Purpose
epub_view EPUB rendering
syncfusion_flutter_pdfviewer PDF rendering

Utilities

Package Purpose
path_provider Local file paths
flutter_cache_manager Ebook file caching
file_picker Book upload from device
image_picker Custom cover images
google_fonts Typography (Inter)
http Dictionary API calls
uuid Unique ID generation
intl Date formatting
shared_preferences Theme persistence

πŸš€ Getting Started

Prerequisites

  • Flutter SDK ^3.11.1
  • A Firebase project with Firestore, Storage, and Auth enabled

Setup

  1. Clone the repository:

    git clone https://github.com/sachinksamad1/ebook-reader.git
    cd ebook_reader
  2. Configure Firebase:

    • Create a Firebase project
    • Create a Firestore database (Native mode, Database ID: ebook-reader)
    • Enable Firebase Storage and Authentication
    • Add your google-services.json (Android) to android/app/
  3. Install dependencies:

    flutter pub get
  4. Run the app:

    flutter run

πŸ“„ Data Flows

Book Upload

Select file β†’ Upload to Firebase Storage β†’ Save metadata to Firestore β†’ Display in Library

Reading

Select book β†’ Download from Storage β†’ Cache locally β†’ Render in reader

Dictionary Lookup (PDF)

Select text β†’ Extract word β†’ Call Dictionary API β†’ Show popup β†’ Optionally save to vocabulary

πŸ“¦ Release & Versioning

The project uses GitHub Actions for automated Android releases.

Triggering a New Release

  1. Update the version in pubspec.yaml (e.g., version: 1.0.1+2).
  2. Add entry to CHANGELOG.md with the new version and its changes.
  3. Commit and Push these changes to main.
  4. Create a Git Tag matching the version (e.g., v1.0.1+2):
    git tag v1.0.1+2
    git push origin v1.0.1+2

The Build & Release workflow will automatically:

  • Build the Android APK in release mode.
  • Create a new GitHub Release with the APK attached.
  • Use the content from CHANGELOG.md for the release notes.

πŸ“œ License

This project is for personal use.

About

A minimal, fast, and distraction-free ebook reader built with Flutter, designed for language learners, students, and knowledge workers.

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

No releases published

Packages

 
 
 

Contributors