Isomorphic Rescript to MoonBit

Isomorphic Rescript for backend and frontend and shared types is something I had been thinking for a while. Recently I started experimenting this idea again with MoonBit, and something clicked that I thought some fellow ReScript folks might find interesting.

The familiar idea

ReScript made it really nice to share code between frontend and backend:

  • shared types
  • shared validation
  • shared domain logic

But in practice the backend still ends up running on Node.

That works, but sometimes you’d prefer:

  • native binaries
  • predictable deployment
  • no JS runtime on the server

MoonBit’s take

MoonBit can compile the same code to:

  • JavaScript → for the browser
  • native backend → for servers

So the mental model becomes:

MoonBit
  ├─ JS → frontend
  └─ native → backend

instead of

ReScript
  ├─ JS → frontend
  └─ JS → Node backend

The isomorphic project explores exactly this idea: write logic once, run it in both places — but the server can be native, not Node. Plus derive(ToJson, FromJson), this makes the dev experience really nice.

It is still early days, but with the help of AI, I can whip quite a large app really quick(backend+frontend), so excited to share with you and hear your feedback!