Skip to content

JMoogs/djp

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

44 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

djp

A native desktop Japanese dictionary and HTTP lookup server, built on a data pipeline that ingests over one million entries from JMdict and KANJIDIC.

Overview

djp is two things: a Tauri desktop application for offline Japanese dictionary lookups, and a standalone HTTP server (djpserver) that exposes the same dictionary and Anki card creation over a REST API — usable from browser extensions, scripts, or any HTTP client. The core data layer is a SQLite database with normalised tables and composite indexes enabling near-instant term and kanji resolution regardless of dictionary size.

Dictionaries are loaded from the Yomitan zip format, which means any of the hundreds of community-maintained Yomitan dictionaries work out of the box — JMdict, KANJIDIC, pitch accent data, frequency lists, and more. Each source is tracked independently so lookups can return results from multiple dictionaries side-by-side, sorted by a configurable source priority order.

Features

  • Multi-source lookup — results from every loaded dictionary are merged at query time and presented grouped by source, ordered by user-defined priority
  • Three query modes per entry type — exact match, by reading (hiragana/katakana/romaji), and by meaning (English FTS over the simple_index column)
  • Romaji → kana conversion — a mora-aware parser handles all standard Hepburn variants, including double-consonant gemination (e.g. kkっk) and the n/vowel ambiguity
  • Pitch accent — downstep position and devoiced/nasal sound positions stored per reading, displayed inline on search results
  • Anki integration — one-click card creation via AnkiConnect with fully configurable field mappings per note type; supports audio, image, and video attachments
  • Persistent, user-ordered source list — dictionaries can be reordered and removed at runtime; source priority is persisted in metadata.json alongside the database
  • Normalised SQLite schema — terms and kanji are stored across purpose-built tables (TermReadings, KanjiReadings, TermPitch, TermIpa, etc.) rather than as serialised blobs, making the data portable and queryable with standard SQL tools
  • Yomitan structured content — the full StructuredContent node tree (tables, ruby, images, collapsible details) is parsed and rendered as HTML in the frontend

djpserver

djpserver is a standalone binary in the same workspace. It loads the same SQLite dictionary as the desktop app (shared path via platform directories) and listens on port 6979 by default.

Endpoints

Method Path Description
GET /lookup?q=<term> Dictionary lookup — returns all kanji and vocabulary matches as JSON
GET /anki/decks List all deck names from a running AnkiConnect instance
GET /anki/models List all note type names
GET /anki/models/:model/fields List field names for a given note type
POST /anki/cards Add a card to Anki

The POST /anki/cards body contains the deck name, a field mapping, and the card data — the server is stateless and requires no prior configuration.

Run

cargo run -p djpserver

Override the port with the PORT environment variable. CORS is permissive by default for browser extension access. Logging is controlled via RUST_LOG (defaults to djpserver=info).


Tech Stack

Layer Technology
Desktop runtime Tauri 2
Backend Rust
Database SQLite via rusqlite
Serialisation bincode (entry storage), serde_json (Yomitan parsing)
Frontend React 18 + TypeScript
Styling Tailwind CSS + DaisyUI
Build tooling Vite

Getting Started

Prerequisites

Install and run

cd djp
npm install
npm run tauri dev

Build a release binary

cd djp
npm run tauri build

The packaged application is written to djp/src-tauri/target/release/bundle/.

Loading dictionaries

djp does not ship with dictionary data. On first launch, open Dictionary Setup and add any Yomitan-format .zip file. The application will parse, index, and persist the data. Yomitan's recommended dictionaries page is a good starting point.

Anki integration

djp connects to AnkiConnect running on localhost:8765. In the Anki screen, select a target deck and note type, then map djp fields to your note's fields. Once configured, any vocabulary result can be sent to Anki in a single click from the Lookup screen.

About

A Japanese Dictionary

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors