A minimal MoonBit project template with CI, justfile, and AI coding assistant support.
Clone this repository and start coding:
git clone https://github.com/mizchi/moonbit-template my-project
cd my-projectUpdate moon.mod.json with your module name:
{
"name": "your-username/your-project",
...
}Set up pre-commit hooks with prek:
prek installOptional: install starlint for MoonBit linting, then uncomment the starlint hook in .pre-commit-config.yaml:
moon install mizchi/starlint/cmd/starlintjust # check + test
just fmt # format code
just fmt-check # verify formatting
just check # type check
just test # run tests
just test-update # update snapshot tests
just run # run main
just info # generate type definition files
just ci # local CI equivalent for default target
just ci-all # lint + js/native test matrix
just release-check-all # release check on js + nativemy-project/
├── moon.mod.json # Module configuration
├── src/
│ ├── moon.pkg # Package configuration
│ ├── lib.mbt # Library code
│ ├── lib_test.mbt # Tests
│ ├── lib_bench.mbt # Benchmarks
│ ├── README.mbt.md # Package README + doc tests
│ ├── quickcheck_test.mbt # Property tests
│ └── main/
│ ├── moon.pkg
│ └── main.mbt # Entry point
├── justfile # Task runner
└── .github/workflows/
└── ci.yml # GitHub Actions CI
src/directory structure withmoon.pkgformat- Snapshot testing with
inspect() - Doc tests in
.mbt.mdfiles - Property-based tests with
moonbitlang/quickcheck - Benchmarks with
moon bench - GitHub Actions CI with format and
.mbtiverification - Pre-commit hooks via prek (optional starlint)
- Claude Code / GitHub Copilot support (AGENTS.md)
- Latest MoonBit update as of 2026-03-08: MoonBit 0.8.0 Released (2026-02-09)
- Property testing reference: moonbitlang/quickcheck
To build a CLI tool, use the feat/cli branch:
git clone -b feat/cli https://github.com/mizchi/moonbit-template my-cliThe feat/cli branch includes:
src/cmd/app/- CLI executable (is-main: true, native target)install.sh- curl-based installer script.github/workflows/release.yml- Builds and releases linux-x64 / macos-arm64 binaries- Two install methods:
moon installandcurl | sh
Before tagging a release:
- Update
moon.mod.jsonversion and metadata (repository,keywords,description) - Update
CHANGELOG.md - Run
just release-check-all - Create annotated tag (for example:
git tag -a v0.2.0 -m "Release v0.2.0") - Push branch and tag
Apache-2.0