目录

MoonBit Multi-Language CMS (moonbit-multilang-cms)

A high-performance, multi-language, full-stack Content Management System (CMS) built entirely in MoonBit using the moonback web server framework and the async runtime.

🚀 Features

  • Server-Side Rendering (SSR): Dynamic page generation with an adaptive CSS glassmorphic dark-theme UI.
  • Multi-Language Translation Engine (i18n): Fully native translation capabilities supporting fallback locales and simple dictionary lookups for English, Simplified Chinese, Traditional Chinese, and Japanese.
  • Multi-Language Mock Database: A memory-backed store loaded with multi-lingual seed articles, mimicking real-world CMS storage.
  • Automatic & Manual Locale Routing: Uses URL parameters (?lang=zh) and persistent browser cookies to detect, set, and switch language interfaces automatically.
  • Article Management Editor: Web interface and REST API endpoint (POST /api/articles) allowing users to create new articles in their selected language.

📂 Project Architecture

moonbit-multilang-cms/
├── cmd/
│   └── main/
│       ├── main.mbt        # Web server entry point, routing, and form parsing
│       └── moon.pkg        # Package config & imports
├── src/
│   ├── i18n/
│   │   ├── i18n.mbt        # Translation engine & key-value localizer
│   │   ├── i18n_test.mbt   # i18n unit tests
│   │   └── moon.pkg
│   ├── db/
│   │   ├── db.mbt          # File-backed database simulation and seeds
│   │   ├── db_test.mbt     # Database CRUD unit tests
│   │   └── moon.pkg
│   └── templates/
│       ├── templates.mbt   # Server-side HTML/CSS UI layouts & pages
│       ├── templates_test.mbt # UI rendering tests
│       └── moon.pkg
├── moon.mod                # Module definition and dependencies
├── LICENSE                 # Apache-2.0 license file
└── README.md               # Project documentation

🛠️ Getting Started

Prerequisites

  • MoonBit Toolchain: Ensure moon CLI is installed (moonc v0.10.3 or later).
  • C Compiler (Optional): A system C compiler (like gcc, clang, or cl) is required for building native binaries and running native tests.

Build and Run

  1. Clone the Repository:

    git clone https://github.com/weidekais/moonbit-multilang-cms.git
    cd moonbit-multilang-cms
  2. Verify & Compile:

    moon check
  3. Run the Web Server (Native Target):

    moon run cmd/main

    The server will start listening at: http://127.0.0.1:3000

Running Tests

If a system C compiler is available, you can run tests natively:

moon test

📝 License

This project is licensed under the Apache License 2.0. See the LICENSE file for details.

关于

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

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

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