目录

moonbase

A MoonBit workspace for building web applications and shared libraries.

Modules

libs

Shared libraries used across the workspace.

url

A complete RFC 3986 URL parsing package, modeled after Go’s net/url. Provides URL parsing, component extraction, percent-encoding, and query string handling.

let u = @url.parse("https://user:pwd@example.com:8080/path?q=v#frag").unwrap()
assert_eq!(u.scheme?, "https")
assert_eq!(u.user_info?.username, "user")
assert_eq!(u.host?, "example.com:8080")
assert_eq!(u.path?, "/path")
assert_eq!(u.query?, "q=v")
assert_eq!(u.fragment?, "frag")

jwt

JWT creation, signing, parsing, and validation with HMAC-SHA256 (HS256). Supports registered claims (RFC 7519) and extensible custom claims.

let method = new_hmac_sha256(b"secret-key")
let claims = RegisteredClaims::new(subject="user123")
let token = Token::sign(method, claims)

let parser = Parser::new()
let (token, claims) = parser.parse("eyJhbG...", method)
assert_eq!(claims.subject?, "user123")

time

A Datetime wrapper around moonbitlang/x/time (ZonedDateTime) with ISO 8601 serialization and PostgreSQL timestamptz compatibility.

let dt = @time.now()
let s = dt.to_iso8601()   // "2026-07-03T12:34:56.123Z"
let parsed = @time.Datetime::from_iso8601(s).unwrap()
assert_eq!(dt, parsed)

moonstore

An object storage service with a REST-ish HTTP API, inspired by S3-style buckets and objects.

  • Buckets & objects — create buckets, upload/download objects, list with prefixes, copy/move/delete
  • Storage backendsMemoryBackend for tests, LocalFSBackend for filesystem persistence
  • Metadata repos — in-memory (MemoryBucketRepo/MemoryObjectRepo) or PostgreSQL (PGRepo) via mattn/postgres
  • Authorization — Cedar policy engine integration through mooncedar
  • HTTP API — bucket and object routes built on pony
// In-memory server (moonstore/cmd/storage)
let storage = @repo.new_storage()
let router = @pony.Router::Router()
@api.build_bucket_routes(router, storage) catch { _ => panic() }
@api.build_object_routes(router, storage) catch { _ => panic() }
@pony.start("0.0.0.0:3000", router)
// PostgreSQL-backed metadata with local filesystem object storage
let storage = @repo.new_postgres_storage(
  "postgres://postgres:111111@localhost:5432/postgres",
)
// Tables are created automatically by migrate().

Getting Started

# Clone the repo
git clone git@github.com:jaredzhou/moonbase.git
cd moonbase

# Run tests
moon test --all

# Check the workspace
moon check

License

Apache 2.0 — see LICENSE for details.

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

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