Skip to main content
An Open-Source Project by sepTN

Offline Kanji Data. Zero Dependencies.

A distilled, lightning-fast database of 13,000+ kanji characters and related vocabulary. Optimized with lazy-loading shards for memory-constrained serverless environments.

Install command

npm install kanji-data

The Problem

Accessing a comprehensive Japanese dictionary offline usually means parsing a massive 100MB+ JSON file.

  • Blocks the Node.js event loop and hurts app startup times.
  • Can consume 300MB+ of RAM once parsed, crashing serverless environments such as Vercel or AWS Lambda.
  • Relying on SQLite introduces bulky C++ dependencies (node-gyp) that often fail to install.

The Solution

kanji-data solves the memory problem with build-time data sharding and lazy evaluation.

  • Instead of shipping one massive file, the database is pre-compiled into tiny optimized chunks.
  • Core metadata loads instantly.
  • Vocabulary lists are split by Unicode hex prefixes and loaded into memory in ~1MB chunks only when requested.

Key Features

Zero Dependencies

Pure JavaScript and JSON. No databases, no native binaries.

Serverless Ready

Cold starts stay near-instant with a tiny memory footprint.

100% Offline

No API keys, no rate limits, no network latency.

Smart Caching

Chunks stay cached in memory after the first read.

Dead Simple API

Clearly structured and ready in milliseconds.

Usage example
const kanji = require('kanji-data');

// 1. Get core metadata instantly
const neko = kanji.get('猫');
console.log(neko.meanings);    // ['cat']
console.log(neko.kun_readings); // ['ねこ']
console.log(neko.jlpt);        // 3

// 2. Fetch vocabulary (lazily loads a ~1MB shard)
const nekoWords = kanji.getWords('猫');
console.log(nekoWords[0]);

// 3. Get entire JLPT lists
const n5 = kanji.getJlpt(5);

// 4. Get kanji by school grade
const grade1 = kanji.getGrade(1);

Interactive Explorer

Inspect the output shape in your browser. This demo uses a small sample set.

This web demo supports 水, 火, 猫, 食, and 電. The npm package supports 13,000+ characters offline.

Official API Reference

get(character: string): Object | null

Returns core metadata for a kanji character. Extremely fast because core metadata is kept small and loaded on init. Returns null if the character is not found.

getWords(character: string): Array

Returns vocabulary entries that use the specified kanji. The first call for a character reads the ~1MB dictionary shard and caches it in memory. Returns an empty array when no words exist.

getJlpt(level: number): Array<string>

Returns kanji for JLPT levels 1–5. Invalid levels return an empty array.

getGrade(grade: number): Array<string>

Returns kanji taught in a Japanese school grade. Grades 1–6 are elementary (教育漢字). Grade 8 covers remaining Jōyō kanji. Grade 9 covers Jinmeiyō name kanji.

License and Data Sources

Code is MIT-licensed. Data via kanjiapi.dev, using EDICT and KANJIDIC — © EDRDG, used under their licence. MIT · kanjiapi.dev · EDRDG · licence

Related

IDENESPTFR