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... | Use | Language |
|---|---|---|
| Build a documentation site | Sol SSG | Markdown + Islands |
| Build a full-stack web app | Sol | MoonBit |
| Add reactivity to existing pages | Luna UI | JavaScript/TypeScript |
| Learn fine-grained reactivity | Luna UI Tutorial | JS 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
| Framework | Bundle 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
| Scenario | Luna | React |
|---|---|---|
| 100ร100 DOM shooting game | 60 FPS | 12 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.
| Aspect | JavaScript Frameworks | Luna (MoonBit) |
|---|---|---|
| Type Safety | Runtime errors | Compile-time errors |
| SSR Performance | V8 overhead | Native speed |
| Bundle Size | Framework + App | Optimized output |
| Dead Code | Tree-shaking | Guaranteed 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
| Package | Description |
|---|---|
@luna_ui/luna | Core UI library + CLI for scaffolding |
@luna_ui/sol | SSR/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
Start with JavaScript Tutorial
For MoonBit Developers
Start with MoonBit Tutorial
Explore MoonBit API Reference
Build server-side components with Sol
Feature Comparison
| Feature | Luna UI | Sol SSG | Sol |
|---|---|---|---|
| Signals | โ | โ | โ |
| Islands | โ | โ | โ |
| SSR | - | Build-time | Runtime |
| Routing | - | File-based | File-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.