[{"data":1,"prerenderedAt":132},["ShallowReactive",2],{"page:\u002Farticles\u002Fmahjong-docker":3},{"id":4,"title":5,"author":6,"body":10,"cover":118,"date":119,"description":120,"extension":121,"head":122,"layout":125,"meta":126,"navigation":127,"path":128,"seo":129,"stem":130,"__hash__":131},"pages\u002Farticles\u002F16.mahjong-docker.md","Self-Hosting a Multiplayer Mahjong Table",{"name":7,"avatarUrl":8,"link":9},"Likun Cai","https:\u002F\u002Favatars.githubusercontent.com\u002Fu\u002F103620968?v=4","https:\u002F\u002Fgithub.com\u002FAlchemist-Aloha",{"type":11,"value":12,"toc":115},"minimark",[13,17,25,28,33,36,86,93,96,111],[14,15,5],"h1",{"id":16},"self-hosting-a-multiplayer-mahjong-table",[18,19,20,24],"p",{},[21,22,23],"code",{},"mahjong-docker"," is a full-stack online Mahjong game packaged for self-hosting. It supports custom rooms, human players, heuristic computer opponents, session recovery after a refresh or disconnect, and a responsive interface designed for both desktop and touch screens.",[18,26,27],{},"The React and TypeScript frontend renders a high-resolution vector tile set, themes, hands, discards, prompts, and room state. The Node.js, Express, and Socket.IO backend owns the game state machine, scoring, room lifecycle, and reconnect behavior. The rules engine supports drawing, discarding, chi, pong, kong, flower replacement, self-draw wins, and wins from another player's discard, with claim priority handled by the server.",[29,30,32],"h2",{"id":31},"start-a-local-build","Start a local build",[18,34,35],{},"With Docker and Docker Compose installed:",[37,38,43],"pre",{"className":39,"code":40,"language":41,"meta":42,"style":42},"language-bash shiki shiki-themes github-light github-dark","git clone https:\u002F\u002Fgithub.com\u002FAlchemist-Aloha\u002Fmahjong-docker.git\ncd mahjong-docker\ndocker compose up --build\n","bash","",[21,44,45,61,71],{"__ignoreMap":42},[46,47,50,54,58],"span",{"class":48,"line":49},"line",1,[46,51,53],{"class":52},"sScJk","git",[46,55,57],{"class":56},"sZZnC"," clone",[46,59,60],{"class":56}," https:\u002F\u002Fgithub.com\u002FAlchemist-Aloha\u002Fmahjong-docker.git\n",[46,62,64,68],{"class":48,"line":63},2,[46,65,67],{"class":66},"sj4cs","cd",[46,69,70],{"class":56}," mahjong-docker\n",[46,72,74,77,80,83],{"class":48,"line":73},3,[46,75,76],{"class":52},"docker",[46,78,79],{"class":56}," compose",[46,81,82],{"class":56}," up",[46,84,85],{"class":66}," --build\n",[18,87,88,89,92],{},"Open ",[21,90,91],{},"http:\u002F\u002Flocalhost:53000",". The repository also publishes frontend and backend images on GHCR for deployments that should not compile locally. In production, place the frontend behind a TLS-terminating reverse proxy and preserve WebSocket forwarding for Socket.IO.",[18,94,95],{},"The bots use hand-value heuristics rather than a general game-playing model. They preserve useful pairs and sequence shapes, discard isolated tiles, and vary some calls to avoid perfectly mechanical play. That keeps local games moving without pretending the computer players are tournament-level opponents.",[18,97,98,99,106,107,110],{},"Visit the ",[100,101,105],"a",{"href":102,"rel":103},"https:\u002F\u002Fgithub.com\u002FAlchemist-Aloha\u002Fmahjong-docker",[104],"nofollow","Mahjong Docker repository"," for deployment examples and the detailed architecture documents under ",[21,108,109],{},"docs\u002F",".",[112,113,114],"style",{},"html pre.shiki code .sScJk, html code.shiki .sScJk{--shiki-default:#6F42C1;--shiki-dark:#B392F0}html pre.shiki code .sZZnC, html code.shiki .sZZnC{--shiki-default:#032F62;--shiki-dark:#9ECBFF}html pre.shiki code .sj4cs, html code.shiki .sj4cs{--shiki-default:#005CC5;--shiki-dark:#79B8FF}html .default .shiki span {color: var(--shiki-default);background: var(--shiki-default-bg);font-style: var(--shiki-default-font-style);font-weight: var(--shiki-default-font-weight);text-decoration: var(--shiki-default-text-decoration);}html .shiki span {color: var(--shiki-default);background: var(--shiki-default-bg);font-style: var(--shiki-default-font-style);font-weight: var(--shiki-default-font-weight);text-decoration: var(--shiki-default-text-decoration);}html .dark .shiki span {color: var(--shiki-dark);background: var(--shiki-dark-bg);font-style: var(--shiki-dark-font-style);font-weight: var(--shiki-dark-font-weight);text-decoration: var(--shiki-dark-text-decoration);}html.dark .shiki span {color: var(--shiki-dark);background: var(--shiki-dark-bg);font-style: var(--shiki-dark-font-style);font-weight: var(--shiki-dark-font-weight);text-decoration: var(--shiki-dark-text-decoration);}",{"title":42,"searchDepth":63,"depth":63,"links":116},[117],{"id":31,"depth":63,"text":32},"\u002Farticles\u002Fmahjong-docker-cover.webp","2026-08-12T00:16:00.000Z","Run a responsive online Mahjong game with private rooms, human players, heuristic bots, reconnectable sessions, and Docker Compose.","md",{"title":123},{"Mahjong Docker":124},"A Self-Hosted Table for Humans and Bots","page",{},true,"\u002Farticles\u002Fmahjong-docker",{"title":5,"description":120},"articles\u002F16.mahjong-docker","o0TVCZ4dDaFYJpOaXsqUT9DaovwwOCdfZXAEUQwnH7E",1786980373683]