A simple, self-hosted web UI and desktop app for searching through text files using ripgrep and ripgrep-all.
- Streaming results realtime to the UI.
- Context lines (before/after) and matching text highlighting.
- Directory and file-pattern filtering.
- Fast first paint: only root-level directories initially; fetch more on demand.
- Modal preview for files; DOCX/DOC are converted to text for readability.
rgaadapters for more formats:- DOCX: via
pandoc(built-inrgaadapter) - DOC: via
antiword(custom adapter) - PDF: via
pdftotext(poppler) - JSON: via
gron(custom adapter) to flatten keys/values
- DOCX: via
- Responsive design using Tailwind CSS.
Both Desktop and Web expose a single “نمط البحث” control with four modes:
- ذكي (Smart): Fast path. Only expands base letters and turns spaces into gaps; no PCRE and no extra mark handling. If you type diacritics, they are treated literally.
- تجاهل التشكيل (Ignore): Matches with or without diacritics by allowing optional combining marks (and tatweel) after Arabic letters. Enables PCRE2.
- التزام التشكيل (Require): Enforces diacritics only where you typed them in your query (per-letter). Enables PCRE2.
- تعبير اعتيادي (Regex): Uses your regex pattern as-is.
Notes
- PCRE2 is enabled only when needed (Ignore / Require). Expect slower searches in those modes.
- “Smart” is the default for performance and predictable results.
- Backend: Python, NanoDjango, Granian (ASGI Server)
- Search: ripgrep (rg), ripgrep-all (rga)
- Frontend: HTML, Tailwind CSS (via CDN), htmx
- Packaging & Runtime: Docker, uv
- Desktop: Tauri + PyTauri + SvelteKit + Shadcn
- Clone the repository:
git clone https://github.com/yshalsager/mini-baheth.git
cd mini-baheth- Prepare Environment:
Create a .env and fill in the required information as defined in [mise.toml] env section:
# Hostname for Traefik (if using the override)
# TRAEFIK_HOST=baheth.yourdomain.com
# Optional: Override default Granian settings
# GRANIAN_PORT=5001
# GRANIAN_WORKERS=8
# GRANIAN_THREADS=4- Place your data:
Put or symlink the directories and files you want to search inside the data/ directory. Symlinks are followed safely with cycle protection.
The image installs:
- ripgrep, ripgrep-all
- pandoc (DOCX), antiword (DOC), gron (JSON)
- poppler-utils (pdftotext) for PDF support
It ships an rga config at /etc/rga/config.json that enables custom adapters for antiword and gron.
Build and run:
docker compose up --build -d- Ensure you have Python 3.13+ and uv.
- Install Python deps:
uv sync - Install system tools:
- ripgrep, ripgrep-all
- pandoc (DOCX), antiword (DOC), gron (JSON)
- Any other system-level dependencies (refer to the Dockerfile for a complete list)
- Run the application:
uv run granian webapp.app:app.asgiThe application should now be accessible at http://127.0.0.1:5000 (or the GRANIAN_PORT you configured).
- The server chooses
rgawhen the file filter is*.doc,*.docx,*.pdf, or*.json, otherwise it usesrg. When usingrga, it passes--rga-config-file=rga.config.jsonif present (or/etc/rga/config.jsonin Docker). - Modal preview:
.docxuses pandoc;.docuses antiword;.pdfusespdftotextwhen available; other files are read as text. - PDF search/preview requires
pdftotext(poppler). It is not bundled. Install it on your system (e.g., macOS:brew install poppler, Debian/Ubuntu:apt install poppler-utils, Arch:pacman -S poppler). - Ignore/Require enable PCRE2 (
-P) in ripgrep which can be slower; prefer Smart when you don’t need diacritic-awareness.
An example override file is provided for integrating with a Traefik reverse proxy setup.
- Copy the example override file:
cp docker-compose.override.yml.example docker-compose.override.yml- Configure Hostname:
- Edit the
.envfile and setTRAEFIK_HOSTto the public hostname you want to use (e.g.,TRAEFIK_HOST=baheth.yourdomain.com).
- Edit the
- Prerequisites: Ensure Traefik is running and connected to an external Docker network named
web. - Run: Start the stack using
docker compose up --build -d. Traefik will automatically pick up the labels and route traffic.
webapp/app.py: Main NanoDjango application, defines routes and search logic.templates/: HTML templates for the UI.data/: Mount point for the files/directories you want to search.Dockerfile: Defines the Docker image build process.docker-compose.yml: Defines the Docker Compose service for development/basic deployment.docker-compose.override.yml.example: Example override for Traefik integration.pyproject.toml: Project metadata and Python dependencies (managed byuv).
Build a native desktop app with embedded Python.
- Install deps
- In
desktop/:mise x pnpm -- pnpm install
- In
- Download embedded Python (first time only)
- In
desktop/:mise x uv -- uv run ./scripts/download_python.py
- In
- Build
- In
desktop/:mise r //desktop:build
- In
Artifacts
- macOS:
desktop/target/bundle-release/bundle/macos/mini-baheth.app - Windows:
.msi/.exeunderdesktop/target/**/bundle - Linux:
.deb/.rpmunderdesktop/target/**/bundle
Notes
- Bundles include the
corepackage and staged tools (rg,rga,rga-preproc,gron,pandoc). - If
rga.config.jsonexists at repo root, it’s bundled and used automatically forrgasearches.
This project relies on several fantastic open-source tools:
- Ripgrep for its incredibly fast search capabilities.
- Ripgrep-all for its ability to search through more file types.
- Pandoc for its ability to convert DOCX to text.
- Antiword for its ability to convert DOC to text.
- Gron for its ability to convert JSON to text.
- NanoDjango for providing a minimal Django-like web framework.
- Granian as the high-performance ASGI server.
- uv for fast Python packaging and resolution.
- Tailwind CSS for the utility-first CSS framework.
- htmx for simplifying dynamic HTML interactions.
This project uses several tools to streamline the development process:
mise is used for managing project-level dependencies and environment variables. mise helps ensure consistent development environments across different machines.
To get started with mise:
- Install mise by following the instructions on the official website.
- Run
mise installin the project root to set up the development environment.
UV is used for dependency management and packaging. It provides a clean, version-controlled way to manage project dependencies.
To set up the project with UV:
- Install UV by following the instructions on the official website.
- Run
uv syncto install project dependencies.
