目录

MoonBit Multi-Language CMS

MoonBit Multi-Language CMS is a small, strongly typed content platform for multilingual editorial sites. It combines server-rendered pages, locale-aware content workflows, an in-memory data layer, and reusable content services in a single MoonBit module.

Project positioning

The project is designed for teams that need a predictable content core without introducing a large application framework. The public API is organized around content records, catalog queries, workflow transitions, rendering, feeds, storage envelopes, and operational policies. The web application in cmd/main provides a runnable reference site; the reusable logic lives in src/core and the supporting packages under src.

Core capabilities

  • Multilingual content records with locale fallback, tags, validation, pagination, and status transitions.
  • Markdown parsing and safe HTML rendering for headings, lists, quotes, code blocks, links, and inline formatting.
  • Catalog, revision history, search indexing, duplicate detection, batch validation, and import/export helpers.
  • SSR reference pages, article creation endpoint, RSS/JSON Feed/sitemap generation, and URL/query parsing.
  • Access policies, webhook delivery tracking, notification queues, rate limiting, scheduled publication, audit trails, health reports, and metrics.
  • Native-friendly deterministic tests and no application database or network service required for the core package.

Quick start

Prerequisites: the current stable MoonBit toolchain and a native C compiler for native tests. The supported runtime target for this module is native: the reference HTTP server and its moonback networking stack use native socket APIs.

git clone https://github.com/liuzhiyug/moonbit-multilang-cms.git
cd moonbit-multilang-cms
moon update
moon fmt --check
moon check --deny-warn
moon test --deny-warn --target native

Run the reference server locally:

moon run cmd/main

It listens on http://127.0.0.1:3000 by default.

CLI and HTTP surface

The runnable entry point is cmd/main. It starts the reference server and exposes:

Route Purpose
GET / Localized article index; use ?lang=en, ?lang=zh, or a cookie for locale selection.
GET /article?id=<id> Localized article detail page.
GET /editor Article editor page.
POST /api/articles Creates an article from form fields title, author, content, and locale.

For library consumers, import the src/core package and compose ContentCatalog, CmsService, ContentQuery, SearchIndex, or the operational components directly.

Architecture

cmd/main        reference HTTP application and routing
src/core        content domain, workflows, rendering, storage, operations
src/db          deterministic in-memory article store and seed data
src/i18n        locale dictionaries and translation lookup
src/templates   server-rendered HTML views
benchmarks      reproducible local measurement notes

The core is deliberately split into cohesive modules. Domain records and queries are independent from transport code; operational concerns such as caching, events, metrics, auditing, and rate limiting can be adopted separately.

Benchmarks

The repository records local wall-clock measurements in benchmarks/README.md. They are intended for regression comparison on the same machine and toolchain, not as cross-machine performance claims.

Testing and quality gates

Run the complete local quality gate with:

moon fmt --check
moon check --deny-warn
moon test --deny-warn --target native
moon info
git diff --check

The test suite covers validation boundaries, pagination, locale routing, Markdown rendering, storage round trips, catalog revisions, workflow transitions, search updates, webhook delivery, quotas, snapshots, health aggregation, and operational failure paths.

CI

GitHub Actions runs formatting, strict checking, package metadata generation, and native tests on Ubuntu, macOS, and Windows. Dependency synchronization is performed before the checks so the workflow exercises the declared module graph. See .github/workflows/check.yml.

License

Licensed under the Apache License 2.0.

关于

基于 MoonBit 语言与 moonback 异步 Web 框架构建的,支持多国语言自动路由切换与管理的高性能全栈内容管理系统。

224.0 KB
邀请码
    Gitlink(确实开源)
  • 加入我们
  • 官网邮箱:gitlink@ccf.org.cn
  • QQ群
  • QQ群
  • 公众号
  • 公众号

版权所有:中国计算机学会技术支持:开源发展技术委员会
京ICP备13000930号-9 京公网安备 11010802047560号