- Go 75%
- HCL 12%
- HTML 7%
- CSS 5%
- JavaScript <1%
Japanese β English Dictionary (Tango) #
A self-hosted Japanese β English dictionary. Go backend, server-rendered web UI, full-text search over the JMdict dataset.
Stack #
| Tool | Role |
|---|---|
| Go 1.26 | Application and importer binaries |
| MongoDB 8.3 | Stores parsed dictionary entries |
| Bleve | Full-text search index |
Go html/template + vanilla JS |
Server-rendered UI |
| Just | Task runner |
| Podman + compose | Local containers (MongoDB) |
| Distroless image β Docker Hub | Production artifact (izquiratops/tango) |
| OpenTofu | Infra as code (Hetzner, Cloudflare, TLS) |
| Caddy | Reverse proxy / TLS termination on the server |
| Cloudflare | DNS, CDN cache, R2 object storage + Tofu state |
Architecture #
Hexagonal (ports & adapters). Two binaries under cmd/ share the internal/ packages.
cmd/
application/ HTTP server β dictionary API + web UI
importer/ One-shot CLI β parses JMdict into MongoDB + Bleve
internal/
core/
domain/ Entities (dictionary, transliteration, term typesβ¦)
ports/ Interfaces between core and adapters
application/
usecases/ Search and import logic
adapters/
primary/http/ Handlers, templates, ETag caching
secondary/parser/ JMdict XML parsing
secondary/persistence/ MongoDB
secondary/text_search/ Bleve
secondary/logging/ Logger (lumberjack)
config/ Environment config
web/static/ CSS, JS, images
The importer is host-only β never containerized or exposed. Run it whenever the source data changes; it writes the full data/ folder (MongoDB collections + Bleve index) that ships to production.
Data pipeline #
JMdict_e (XML) β importer β data/mongo + data/bleve_index β R2 bucket β server volume
just download-dictionary # fetch JMdict_e to repo root
just db up # importer needs MongoDB running
just import-dictionary # parse β data/mongo + data/bleve_index
For production, just seed rsyncs data/ to the server (see infra/README.md).
Local development #
Requires Podman and Just.
cp .env.example .env
just db up # MongoDB
just start # run the server (host Go)
Other recipes: just lint, just test, just build [application|importer], just deps. Run just for the full list.
Containers and host-Go recipes both read ./data/ (Mongo dbPath + Bleve index), so the same folder is used locally and in prod.
Configuration #
.env is the single source of tunables, loaded by Just (dotenv-load) for host-Go recipes and by compose for ${VAR} interpolation. In production, infra/cloud-init.yml writes the equivalent values to /opt/tango/.env. The compose files carry no literal config β edit .env (dev) or the cloud-init block (prod).
Deployment #
OpenTofu provisions a Hetzner server, Cloudflare DNS/cache, and origin TLS certs. The server runs tango.service (systemd) with Caddy + MongoDB + app via compose.prod.yml.
just tofu plan / apply # provision infra
just deploy <version> # repoint server to a pushed tag, refresh TLS certs, restart
just seed # push local data/ to the server
Infra details and Cloudflare permissions: infra/README.md.
CI/CD #
Codeberg / Forgejo Actions (.forgejo/workflows/):
ci.ymlβ golangci-lint on PRs tomain.release.ymlβ onv*tags, build the image with buildah and push to Docker Hub.
About AI #
I used LLMs to:
- Work through Go issues β it's not my main language.
- Sound-check architectural decisions.
- Write docs like this README β handy when I return after months and forget the big picture.
- Generate code I review carefully before committing.