Alchemy for MoonBit. MoonBit compiles to JavaScript. A stack, a resource, or an output is the Alchemy object itself, typed with Effect from opraying/effect. There is no second runtime.
@alchemy.run/sigil is not bound. The core can build a neutral bundle that does not import Node or Bun.
./scripts/alchemy-build.sh is the entry point: setup, generate, check, and test. ./scripts/ci.sh is the full gate. ./scripts/new-app.sh scaffolds an example. Commands and invariants are in AGENTS.md.
The binding follows Alchemy: infrastructure described as Effects. Providers are generated from the published @alchemy.run/* packages. The stack, engine, state, and secrets are hand-written so a program can plan and apply without a generated provider. The upstream pin lives in the repository package.json.
examples/app defines a resource class, a provider, and a stack. The provider's reconcile returns the outputs later stages read:
let kv_cls : @Alchemy.ResourceClass[Json] = @Alchemy.ResourceClass::make("Core.KV")
let provider = @Alchemy.ProviderTag::succeed_json(
kv_cls,
reconcile=fn(input) {
@Effect.succeed(Json::object({
"endpoint": Json::string("https://kv.internal/" + input.id()),
}))
},
delete=fn(_) { @Effect.succeed(()) },
)examples/cloud-stack uses real providers. examples/combinators covers names, retention, and outputs. examples/module is the TypeScript consumer of the emitted .d.ts.
The core is Alchemy, Engine, State, Secrets, Auth, Bundle, Command, and Dns. Generated packages cover the cloud providers. A resource prop accepts either a literal or an Output, and an Output resolves to the MoonBit value, not the JavaScript one.
Cloud provider packages (Aws/, Cloudflare/, Gcp/, etc.) are generated bindings linked from the generated/ submodule (opraying/mbt-generated, branch alchemy). Focus edits on the hand-written core and generator:
- Core packages: Alchemy/, Engine/, State/, Secrets/, Auth/, Bundle/, Command/, Dns/, Async/, Interop/, Util/.
- Generator & ABI scripts:
scripts/gen-alchemy.mjs,scripts/alchemy-manifest.mjs,scripts/abi.mjs,scripts/tsrs-ir.mjs,scripts/gen-env.mjs,scripts/gen-dts.mjs,scripts/TRANSLATOR.md. - Build/CI scripts:
scripts/alchemy-build.sh,scripts/ci.sh,package.json.
Apache-2.0. Copyright the opraying contributors.