Moradok Lanna
Dev notes

Dev notes: how Moradok Lanna is built

Moradok Lanna (มรดกล้านนา) is a non-profit website for the Lanna language and culture, the heritage of northern Thailand. Its heart is a Lanna to Thai dictionary of about 17,000 entries, compiled and maintained by its founder. Around that dictionary the site has grown a set of tools: a word of the day, quizzes and games, a Lanna calendar, a typing tutor, a browser-based Lanna text editor, shared writing boards, a Markdown blog, and an AI teacher called "พ่อครู" (Pho Khru, "the master teacher") who answers only from the dictionary.

These notes are the developer's write-up: the stack, the shape of the system, the principles behind it, three case studies, and a changelog of every release. They are written for other developers, and for anyone curious about building software for a small script that most tools ignore.

The stack in one page

Architecture

+------------------------------------------------------+
|  Browser: vanilla JS, self-hosted fonts              |
+--------------------------+---------------------------+
                           |
+--------------------------v---------------------------+
|  Pages (server-rendered PHP)                         |
|  Portal tools | Dictionary | Calendar | Jaan + boards|
+----------+--------------+--------------+-------------+
           |              |              |
+----------v---+  +-------v------+  +----v-------------+
| Shared       |  | AI layer     |  | Accounts         |
| portal       |  | retrieval,   |  | shared sign-in,  |
| library      |  | cache, limits|  | credit tiers     |
+----------+---+  +-------+------+  +----+-------------+
           |              |              |
+----------v--------------v--------------v-------------+
|  Database: dictionary (read-only for features),      |
|  accounts, boards + versions, logs                   |
+------------------------------------------------------+

 Side by side:  Markdown blog (flat files)
                Object storage + CDN (images)
                Hosted LLM, called from the server only

Everything is server-rendered first. JavaScript enhances a page that already works, so search engines, screen readers and slow phones all get real content.

Principles

  1. Dictionary first. The dictionary is the authority for every Lanna spelling, reading and meaning. Features look words up; they do not guess. When the dictionary and a model disagree, the dictionary wins. If a word is missing, the interface says so instead of inventing it.
  2. Privacy. Visitors are not tracked by name. Network addresses are never stored raw. Anonymous features use a random visitor id, and accounts have a "delete my data" page. Analytics is on, and the privacy policy says exactly what is collected.
  3. Everything works without signing in. An account adds saved conversations, saved words and more AI credit. It never gates the dictionary, the tools or the boards.
  4. Accessibility. Real headings and landmarks, a skip link, visible focus, text that scales, and dark mode that follows the device. The tools are keyboard friendly.
  5. Performance on shared hosting. Cache what can be cached (sitemaps, AI answers, daily content), build daily content ahead of time, keep pages small, and avoid anything that needs a long-running process.
  6. SEO-safe changes. Redesigns keep URLs, titles, canonicals and the text of indexed pages unchanged, and are diffed before and after. A navigation change that alters an indexed dictionary page is a bug.
  7. Boring where it counts. Plain files, plain SQL and plain HTTP. Clever is reserved for the hard parts: the editor and live collaboration.

Case studies

About the project

Moradok Lanna is free to use. Optional member packages are planned only to help cover AI running costs. The Lanna script is the Tai Tham script as used in northern Thailand (called "Tilok" here after the font), and many of the engineering problems in these notes come from handling a script that sits outside most software's assumptions: combining marks, stacked consonants and no standard keyboard.

Credits

Designed and built by Jarus Soontornsing (Toni Maxx) (จรุส สุนทรสิงห์) · บริษัท ลอจิกเบเกอร์ จำกัด (LogicBaker Company Limited)

Lanna knowledge and dictionary: อ.จรีย์ สุนทรสิงห์, founder of มรดกล้านนา

LN TILOK font: Center for the Promotion of Arts and Culture, Chiang Mai University.