Menu

Luna Ecosystem Overview

Luna is a suite of tools for building modern web applications with MoonBit and JavaScript. This documentation covers four interconnected projects.

Which Should I Use?

I want to...UseLanguage
Build a documentation siteSol SSGMarkdown + Islands
Build a full-stack web appSolMoonBit
Add reactivity to existing pagesLuna UIJavaScript/TypeScript
Learn fine-grained reactivityLuna UI TutorialJS or MoonBit

Decision Tree

Need a website?
โ”œโ”€โ”€ Static content (docs, blog) โ†’ Sol SSG
โ””โ”€โ”€ Dynamic app (user auth, API) โ†’ Sol

Just learning?
โ”œโ”€โ”€ Know JavaScript โ†’ JS Tutorial
โ””โ”€โ”€ Know MoonBit โ†’ MoonBit Tutorial

Why Luna?

Luna was born from frustration with existing solutions:

  • React - Too large for performance-critical applications

  • Qwik / Solid - Compile-time expansion gets in the way of debugging

  • No WebComponents-first framework existed - Until now

Design Philosophy

So Small That Compile-Time Optimization Is Unnecessary

FrameworkBundle Size
Luna~6.7 KB
Preact~20 KB
Solid~7 KB
Vue 3~33 KB
React~42 KB

Luna is intentionally minimal. The framework overhead is negligible, making compile-time optimizations unnecessary.

WebComponents First (World's First SSR + Hydration)

Luna is the first framework to support WebComponents SSR + Hydration.

  • Native browser standards over framework abstractions

  • Shadow DOM for style encapsulation

  • Declarative Shadow DOM for server rendering

Runtime Performance

ScenarioLunaReact
100ร—100 DOM shooting game60 FPS12 FPS

Fine-grained reactivity delivers 5x better performance in real-world scenarios.

Written in MoonBit

Luna is written in MoonBit - a language designed for cloud and edge computing.

AspectJavaScript FrameworksLuna (MoonBit)
Type SafetyRuntime errorsCompile-time errors
SSR PerformanceV8 overheadNative speed
Bundle SizeFramework + AppOptimized output
Dead CodeTree-shakingGuaranteed elimination

Fine-Grained Reactivity

Unlike Virtual DOM frameworks, Luna updates only what changed - at the DOM node level.

Virtual DOM: State โ†’ Create Tree โ†’ Diff โ†’ Patch (O(n))
Luna:        Signal โ†’ Direct DOM Update (O(1))

Islands + Fine-Grained

Luna combines Islands Architecture with fine-grained reactivity:

  • Partial hydration - Only interactive parts load JavaScript

  • Minimal runtime - ~3KB loader

  • Fast updates - Direct DOM manipulation within islands

Architecture

โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”
โ”‚                     Your Application                         โ”‚
โ”œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ค
โ”‚  Sol SSG (SSG)          โ”‚  Sol (SSR Framework)                 โ”‚
โ”‚  Static docs sites    โ”‚  Full-stack apps with islands        โ”‚
โ”œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ค
โ”‚                       Luna UI                                 โ”‚
โ”‚           Signals, Islands, Hydration, Components            โ”‚
โ”œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ค
โ”‚                      MoonBit / JavaScript                    โ”‚
โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜

Projects

Luna UI - Reactive UI Library

The foundation of everything. Luna provides:

  • Signals - Fine-grained reactive primitives

  • Islands - Partial hydration for optimal performance

  • Components - Web Components with declarative syntax

  • Hydration - Smart loading strategies (load, idle, visible, media)

Sol SSG - Static Site Generator

Build documentation sites and blogs from Markdown. Features:

  • Markdown with frontmatter support

  • Auto-generated navigation and sidebar

  • i18n (internationalization) support

  • Syntax highlighting with Shiki

  • SPA navigation with View Transitions

This documentation site is built with Sol SSG.

Sol - Full-Stack Framework

Server-side rendering framework with Hono integration:

  • Island Architecture for SSR + partial hydration

  • Declarative routing with middleware

  • Server Actions with CSRF protection

  • Nested layouts

  • Streaming SSR

npm Packages

PackageDescription
@luna_ui/lunaCore UI library + CLI for scaffolding
@luna_ui/solSSR/SSG framework CLI (includes Sol SSG)

Quick Start

Luna UI (JavaScript)

npx @luna_ui/luna new myapp
cd myapp && npm install && npm run dev

Luna UI (MoonBit)

npx @luna_ui/luna new myapp --mbt
cd myapp && moon update && npm install && npm run dev

Sol SSG (Documentation Site)

npx @luna_ui/sol new my-docs --ssg
cd my-docs && npm install && npm run dev

Code Examples

JavaScript

import { createSignal, createEffect } from '@luna_ui/luna';

const [count, setCount] = createSignal(0);
createEffect(() => console.log(count()));
setCount(1);  // Logs: 1

MoonBit

let count = @signal.signal(0)
let doubled = @signal.memo(fn() { count.get() * 2 })

@signal.effect(fn() {
  println(count.get().to_string())
})

count.set(1)  // Prints: 1

Learning Paths

For JavaScript/TypeScript Developers

  1. Start with JavaScript Tutorial

  2. Learn Signals and Islands

  3. Build a site with Sol SSG or app with Sol

For MoonBit Developers

  1. Start with MoonBit Tutorial

  2. Explore MoonBit API Reference

  3. Build server-side components with Sol

Feature Comparison

FeatureLuna UISol SSGSol
Signalsโœ…โœ…โœ…
Islandsโœ…โœ…โœ…
SSR-Build-timeRuntime
Routing-File-basedFile-based + API
Markdown-โœ…-
i18n-โœ…-
Middleware--โœ…
Server Actions--โœ…
Web Componentsโœ…โœ…โœ…

Status

Experimental - All projects are under active development. APIs may change.

Built with MoonBit - a fast, safe language for cloud and edge computing.