Skip to main content
This example demonstrates a framework-free implementation of the Quran Search Engine library using vanilla TypeScript and Vite.

Features

  • No framework dependencies (pure TypeScript)
  • Real-time search with debouncing
  • Multiple search modes (exact, lemma, root, fuzzy)
  • Highlighted search results
  • Lightweight and fast
  • Simple class-based architecture

Setup

1

Install dependencies

2

Run the development server

From the workspace root:
Or from the example directory:
3

Open your browser

Navigate to http://localhost:5173

Project structure

This example demonstrates that the Quran Search Engine library works in any JavaScript environment, not just with frameworks.

Application class

The example uses a simple class to manage state and UI:
main.ts

Loading data

Load all datasets asynchronously on initialization:
main.ts

Event listeners with debouncing

Set up event listeners for search input and options:
main.ts
The debounce function prevents search execution on every keystroke, improving performance.

Search implementation

Perform search with user-selected options:
main.ts

Rendering results

Render search results with match statistics:
main.ts

Verse rendering with highlighting

Render individual verses with highlighted matches:
main.ts

Application initialization

Initialize the app when the DOM is loaded:
main.ts

Dependencies

Minimal dependencies for a lightweight setup:
package.json
This example requires only the library itself as a runtime dependency. Vite and TypeScript are development dependencies for the build process.

Key features demonstrated

  • No framework overhead: Pure TypeScript without React, Vue, or Angular
  • Simple architecture: Class-based design for easy understanding
  • Direct DOM manipulation: Using native browser APIs
  • Type safety: Full TypeScript support
  • Modern tooling: Vite for fast development and building
  • Minimal dependencies: Only the essentials