跳到正文
FunCoding

lunora

Type-safe, real-time backend with Vite, Rsbuild and Rspack support, deployed on Cloudflare Workers and Durable Objects. Auth, storage, scheduling and an MCP server for AI agents. Convex-style DX.

Star
304
许可证
Apache-2.0
最近提交
2026年12月1日
Lunora

Type-safe, real-time backend on your own Cloudflare account. Vite-first.

Documentation · Website · Packages · Quick start


typescript-image Apache-2.0 licence Status Node pnpm CI npm version PRs Welcome OpenSSF Scorecard


Daniel Bannert's open source work is supported by the community on GitHub Sponsors. See lunora.sh/sponsors for what sponsorship funds.


What is Lunora?

Lunora gives you Convex-style DX on infrastructure you control. You write type-safe queries, mutations, and actions in TypeScript. In production, Lunora deploys them as Cloudflare Workers: Durable Objects hold real-time state, D1 handles SQL, R2 stores blobs, and Queues run jobs. Nothing runs on servers we operate; the production stack lives in the Cloudflare account you already pay for. See Where it runs for the other targets.

Lunora is Vite-first. The dev loop, codegen, and client bindings plug into a Vite project through @cloudflare/vite-plugin, so local dev runs on workerd, the same runtime as production. Rsbuild and Rspack projects get the same loop through @lunora/rspack, and a standalone CLI covers everything else.

Quick start

pnpm dlx lunorash@alpha init my-app
cd my-app
pnpm install
pnpm dev

Alpha. The npm package is lunorash because the unscoped lunora name is taken; the CLI it installs is still called lunora. Install from the @alpha dist-tag and expect breaking changes until the first stable release (see Status).

Prefer managed hosting, or just want one email when v1 is stable? Join the Lunora Cloud waitlist →

A fresh app has three files you edit:

// lunora/schema.ts
import { defineSchema, defineTable, v } from "lunorash/server";

export default defineSchema({
    messages: defineTable({
        author: v.string(),
        body: v.string(),
        ts: v.number(),
    }),
});
// lunora/messages.ts
import { mutation, query, v } from "./_generated/server";

export const list = query.query(async ({ ctx }) => ctx.db.query("messages").order("desc").take(50));

export const send = mutation.input({ author: v.string(), body: v.string() }).mutation(async ({ ctx, args }) => {
    await ctx.db.insert("messages", { ...args, ts: Date.now() });
});
// src/App.tsx
import { useQuery, useMutation } from "@lunora/react";
import { api } from "../lunora/_generated/api";

export default function App() {
    const messages = useQuery(api.messages.list, {}) ?? [];
    const { mutate: send } = useMutation(api.messages.send);
    return (
        <>
            <button onClick={() => send({ author: "me", body: "hello" })}>Send</button>
            <ul>
                {messages.map((m) => (
                    <li key={m._id}>
                        {m.author}: {m.body}
                    </li>
                ))}
            </ul>
        </>
    );
}

pnpm dev boots workerd, generates the client types, starts the Vite dev server, and reloads on every save. Click the button and the list updates in every open tab; the query re-runs on the server and pushes the new result.

lunora init asks which framework to use and defaults to a React SPA. Pass -t to pick one directly: next, nuxt, sveltekit, astro, analog, tanstack-start-react, tanstack-start-solid, solid-v2, expo, vinext, rspack-react, standalone, and a few more (lunora init --help lists them). Use --vite <framework> for a plain React, Vue, Solid, or Svelte SPA, and lunora init --here to add Lunora to an app you already have.

Why Lunora

Types run end to end. The schema, validators, query results, and client hooks come from one source of truth. The dev server regenerates client types on save, so there is no codegen step to forget.

Queries are live. Clients subscribe over WebSocket, and a mutation pushes the change to every subscriber. You don't write cache invalidation.

Production runs on your account. Cloudflare is the production target: Workers, Durable Objects, D1, R2, Queues, and KV all live in your Cloudflare account. An idle app costs about nothing, and at scale you pay Cloudflare's prices rather than a SaaS markup.

It grows past one Durable Object. Every app starts on a single Durable Object. When one tenant needs its own, add .shardBy(key) to the function; for geo-replicated reads, add .global(). The rest of the app stays the same.

Features come as add-ons. Auth, mail, storage, scheduling, queues and pub/sub topics, workflows, AI agents, payments, feature flags, rate limiting, and notifications ship as @lunora/* packages or as items you copy in with lunora registry add. Other packages add typed access to Cloudflare Containers, Browser Rendering, Hyperdrive, AI Search, and service bindings to sibling Workers.

Sign-in is more than passwords. @lunora/auth wraps better-auth, so passkeys, magic links, email OTP, two-factor, anonymous sessions, and OAuth providers are available through its plugins.

Built for AI agents. @lunora/mcp exposes your deployment's tables, functions, logs, issues, and advisories to MCP clients, so an agent can inspect and debug your app the way you do.

Clients aren't limited to JavaScript. There are adapters for React, Vue, Solid, Svelte, Angular, and React Native, and lunora sdk generate writes typed clients for Python, Go, Ruby, Rust, Swift, Java, Kotlin, and Dart (see sdks/).

The core doesn't depend on Cloudflare. The reactive engine (@lunora/shard-engine) talks to a small set of host contracts in @lunora/platform, not to Cloudflare APIs. @lunora/platform-cloudflare implements those contracts for production and @lunora/platform-node for dev and test. A capability matrix marks each feature as native, emulated, or unsupported per host; codegen leaves out what a host can't run and tells you why.

Where it runs

TargetStatusUse it for
Cloudflare Workers and Durable ObjectsProductionDeploying your app
Node (@lunora/platform-node)Dev and testLocal runs and tests. Not a production target.
Self-hosted on celld (@lunora/platform-celld)ExperimentalSelf-hosting on machines you run

Build with Vite (@lunora/vite), with Rsbuild or Rspack (@lunora/rspack), or with the standalone CLI. The core does not depend on Cloudflare APIs; each target implements the same host contracts in @lunora/platform. Each target's capability matrix says which features it supports.

Lunora Studio

pnpm dev also serves Lunora Studio, a local admin UI for your app. In it you can browse and edit data, run SQL, watch live connections and function metrics, follow logs and traces, and see errors grouped into Issues. Time Travel replays past state, the architecture view draws a diagram from your code's call graph, and the advisors flag security and performance problems in your schema.

Lunora Studio, the local admin UI for your schema, data, functions, and advisors

Read the Studio deep dive →

Lunora vs. the alternatives

LunoraConvexFirebasePlain Cloudflare
Type-safe end-to-endYesYesPartialDIY
Real-time subscriptionsYes (WS, reactive)YesYesDIY
Runs on your accountYes (Cloudflare)No (managed SaaS)No (managed SaaS)Yes
Scales past single DOYes (.shardBy())n/an/aDIY (manual)
Vite-first DXYesn/an/aDIY
Feature breadth (auth, mail, storage, scheduler)Add-ons (alpha)Broad (built-in)Broad (built-in)DIY
Cost at idle≈ $0 (CF free tier)Paid≈ $0 (Spark tier)≈ $0

Convex still has more built in than Lunora. What you get in exchange is ownership of the infrastructure and its cost: an idle Lunora app costs nothing, and at scale you pay Cloudflare's prices rather than a SaaS markup.

Architecture

                        ┌────────────────────────────────────┐
                        │  Browser / Node / RN client        │
                        │  @lunora/client · @lunora/react    │
                        └─────────────────┬──────────────────┘
                                          │  HTTPS + WebSocket (RPC envelope)
                                          ▼
                        ┌────────────────────────────────────┐
                        │  Vite / Rspack dev (workerd)        │
                        │  @lunora/vite · @lunora/rspack      │
                        │  or standalone: @lunora/cli         │
                        └─────────────────┬──────────────────┘
                                          │
                                          ▼
                ┌─────────────────────────────────────────────────┐
                │  Cloudflare Worker — @lunora/runtime            │
                │  · parses RPC      · auth      · routing        │
                │  · upgrades WS to ShardDO via idFromName(key)   │
                └───┬──────────┬───────────┬───────────┬──────────┘
                    │          │           │           │
                    ▼          ▼           ▼           ▼
                ┌───────┐  ┌────────┐  ┌──────┐  ┌──────────┐
                │ Shard │  │Session │  │  D1  │  │R2/Queues │
                │  DO   │  │  DO    │  │ SQL  │  │   KV     │
                │(state)│  │ (auth) │  │      │  │          │
                └───────┘  └────────┘  └──────┘  └──────────┘
                  │
                  ├── SQLite-backed, WebSocket Hibernation API,
                  │   subscription registry
                  │
                  └── @lunora/shard-engine (host-neutral: state, OCC,
                      CDC, reactivity) over @lunora/platform contracts,
                      implemented for this target by
                      @lunora/platform-cloudflare

Packages

All packages are published under the @lunora npm scope (except the unscoped umbrella lunorash) and live under packages/.

This table is generated from each package's package.json and project.json. Run pnpm run generate:packages-list to refresh it.

Runtime

PackageVersionDescription
@lunora/d1npmD1 adapter for Lunora .global() tables, wrapping the Sessions API for read-your-writes
@lunora/donpmLunora Durable Objects: ShardDO (SQLite, OCC, hibernated WebSocket subscriptions) and SessionDO
@lunora/errorsnpmUnified error layer for Lunora: one LunoraError base + a central catalog of codes, statuses, and actionable hints, rendered across CLI, overlay, Studio, and the client
@lunora/fingerprintnpmZero-dependency, cross-runtime error fingerprinting for Lunora: a stable grouping hash that collapses noisy errors into Issues across the local Studio and the Cloud
@lunora/runtimenpmLunora Worker runtime: the RPC router, shard resolver, and query coordinator
@lunora/servernpmServer primitives for Lunora: defineSchema, defineTable, query, mutation, and action
@lunora/sql-storenpmInternal dialect-parameterized SQL store core for Lunora .global() backends (D1, PlanetScale)
@lunora/valuesnpmValidators for Lunora: the v.* validator suite with end-to-end return-type inference
lunorashnpmThe Lunora umbrella package: one install for the server authoring API, worker runtime, Durable Objects, and the lunora CLI

Client & Framework Adapters

PackageVersionDescription
@lunora/angularnpmAngular reactive adapter for Lunora — signal-based live queries and mutations
@lunora/astronpmAstro integration for Lunora — single-worker composition plus reactive-loader server helpers
@lunora/clientnpmLunora browser SDK: WebSocket transport, optimistic updates, and an offline mutation queue
@lunora/dbnpmTanStack DB binding: typed, live-synced collections and a durable offline outbox over the Lunora client
@lunora/nuxtnpmNuxt module for Lunora — single-worker composition (mounts /_lunora/* into Nitro) plus reactive-loader server helpers
@lunora/reactnpmReact hooks for Lunora: useQuery, useMutation, useSubscription, and useAuth
@lunora/react-nativenpmReact Native / Expo integration for Lunora: an AsyncStorage-backed client factory, the useQuery/useMutation/useSubscription hooks, and a one-call better-auth Expo client
@lunora/solidnpmSolidJS adapter for Lunora — live queries, optimistic mutations, and reactive loaders
@lunora/studionpmThe Lunora Studio: a local admin UI for your schema, data, logs, and advisors
@lunora/sveltenpmSvelte adapter for Lunora — live stores, optimistic mutations, and reactive loaders
@lunora/vuenpmVue adapter for Lunora — live composables, optimistic mutations, and reactive loaders

CLI

PackageVersionDescription
@lunora/clinpmThe Lunora CLI: init, dev, deploy, codegen, migrate, seed, doctor, insights, logs, registry, and the rest of the project commands

Codegen

PackageVersionDescription
@lunora/codegennpmCode generator for Lunora: emits _generated/{api,server,dataModel}.ts from your schema

Bundler Plugins

PackageVersionDescription
@lunora/rspacknpmThe Lunora Rspack plugin: codegen, binding provisioning, and wrangler validation for Rspack projects
@lunora/vitenpmThe Lunora Vite plugin: codegen, type sync, wrangler validation, and an error overlay over @cloudflare/vite-plugin

Dev Tools

PackageVersionDescription
@lunora/confignpmInternal shared CLI + Vite config layer for Lunora: wrangler.jsonc validation, binding inference, and .dev.vars scaffolding
@lunora/testingnpmTesting toolkit for Lunora: an in-memory harness for queries, mutations, and actions

Advisor

PackageVersionDescription
@lunora/advisornpmSchema & query lints (splinter-style advisors) for Lunora, feeding the Studio Advisors view

Add-ons

PackageVersionDescription
@lunora/agentnpmDurable AI agents for Lunora: defineAgent compiles a replay-safe tool-loop onto Cloudflare Workflows, with DO SQLite threads and live message subscriptions
@lunora/ainpmWorkers AI helper for Lunora: provider-agnostic AI SDK access from functions, Workers AI by default
@lunora/authnpmAuth for Lunora — a thin better-auth wrapper: email/password, OAuth, plugins, D1-backed
@lunora/bindingsnpmLightweight Cloudflare binding helpers for Lunora — ctx.kv, ctx.images, ctx.analytics, ctx.pipelines, ctx.vectors, ctx.r2sql, ctx.artifacts, ctx.aiSearch, ctx.analyticsSql — one install, per-binding subpaths
@lunora/browsernpmCloudflare Browser Rendering for Lunora: ctx.browser screenshots, PDF, and scraping in actions
@lunora/cloudflare-accessnpmCloudflare Access (Zero Trust) identity for Lunora — verify the Cf-Access-Jwt-Assertion JWT against your team JWKS and feed the verified identity into ctx.auth / RLS via a resolveIdentity adapter
@lunora/jwt-authnpmBring your own auth — verify Clerk, WorkOS, Auth0, Supabase or any OIDC JWT against its JWKS and feed the identity into ctx.auth / RLS
@lunora/containernpmCloudflare Containers for Lunora: defineContainer, generated Container DO classes, and the ctx.containers action surface
@lunora/flagsnpmOpenFeature-based feature flags for Lunora — ctx.flags, useFlag, and a first-class Cloudflare Flagship provider with any OpenFeature provider pluggable
@lunora/hyperdrivenpmBring-your-own Postgres/MySQL for Lunora via Cloudflare Hyperdrive: a driver-agnostic, action-only ctx.sql
@lunora/mailnpmEmail for Lunora: Resend adapter, TSX templates, and queue-backed sends
@lunora/mcpnpmModel Context Protocol server exposing a Lunora deployment to AI agents
@lunora/notifynpmMulti-channel notifications for Lunora — ctx.notify / ctx.push over @visulima/notification: edge-safe Web Push + FCM, plus chat, in-app inbox and webhook channels, with subscription storage and queue-backed fan-out
@lunora/paymentnpmProvider-agnostic payments for Lunora: Stripe-first adapter, webhook sync, and subscription/payment state machine
@lunora/queuenpmCloudflare Queues for Lunora: defineQueue producers + consumers, the ctx.queues surface, and the generated queue() worker handler
@lunora/ratelimitnpmRate limiting: token-bucket / fixed-window / sliding-window algorithms, deny list, pluggable stores, and procedure middleware
@lunora/replicanpmLocal-first replica runtime + local SQLite mirror for Lunora
@lunora/schedulernpmScheduling for Lunora: runAfter / runAt and Cron Triggers via SchedulerDO
@lunora/seednpmSchema-driven, deterministic database seeding for Lunora: realistic fake data from defineSchema
@lunora/storagenpmR2-backed storage for Lunora: typed buckets and signed URLs
@lunora/workflownpmDurable workflows for Lunora: defineWorkflow over Cloudflare Workflows, generated WorkflowEntrypoint classes, and the ctx.workflows surface

Observability

PackageVersionDescription
@lunora/observabilitynpmHost-neutral telemetry storage and read models for Lunora, backing the Studio's Logs, Traces, Metrics and Issues views

Platform

PackageVersionDescription
@lunora/platformnpmProvider-neutral host contracts for Lunora: shard/socket/directory/scheduler interfaces, binding projections, and the platform capability matrix
@lunora/platform-celldnpmcelld implementation of the Lunora platform contracts: the Cloudflare host adapters recomposed for celld (self-hosted distributed Durable Objects) under an honest capability matrix
@lunora/platform-cloudflarenpmCloudflare implementation of the Lunora platform contracts: ShardHost, SocketHost, ShardDirectory, ShardKvStore over Durable Objects
@lunora/platform-nodenpmNode implementation of the Lunora platform contracts: ShardHost, SocketHost, ShardDirectory, ShardKvStore, SchedulerHost over better-sqlite3 and an in-process socket registry (dev/test target)
@lunora/shard-enginenpmHost-neutral reactive engine for Lunora: per-shard state, OCC, CDC, reactive subscriptions, and the poke protocol. Consumes @lunora/platform host contracts and can be mounted on any platform host.

Web3

PackageVersionDescription
@lunora/x402npmAgentic payments (x402) for Lunora: charge agents per request (charge rail) and let your agents pay x402-gated resources (pay rail)

Examples

Runnable apps live in examples/: a todo app, team chat, a kanban board, realtime cursors, chess, a blog, a feedback board, TanStack Start, Expo, and focused demos for auth, payments, notifications, offline rejections, and service bindings.

Documentation

The full docs are at lunora.sh/docs: guides, concepts, framework adapters, and a reference for each package. Good places to start:

Status

Lunora is in alpha, and the APIs will break. Every package publishes continuously to the alpha dist-tag on npm (pnpm add lunorash@alpha). Each package has its own version, so the alpha numbers don't line up across packages. The latest tag only holds a 0.0.x placeholder; run npm view <pkg> dist-tags to see the real version. The API, the package boundaries, and the on-disk layout will all change before the first stable release.

New versions ship often enough to trip pnpm's minimumReleaseAge. If you use that setting, add "@lunora/*" and lunorash to minimumReleaseAgeExclude; otherwise pnpm can resolve a mix of packages that no longer match.

Read the code, file issues, and open PRs against the alpha branch. Just don't build a production system on it yet.

Contributing

Start with .github/CONTRIBUTING.md. The default branch is alpha, and PRs go there unless you are cutting a release.

For security reports, see SECURITY.md. For community guidelines, see .github/CODE_OF_CONDUCT.md. For brand assets and usage rules, see marketing/BRAND.md.

Commercial support

Lunora is built and maintained by Daniel Bannert. If you want help trying Lunora in a project, or need a TypeScript backend or a real-time web app built, he takes on contract work through Anolilab. Book a free first call.

License

Lunora is Apache-2.0 © 2026 anolilab and contributors.

The Lunora Cloud service in apps/cloud/ is licensed under FSL-1.1-Apache-2.0: source-available now, and each release becomes Apache-2.0 two years after it ships.

同类 MCP Server

Netdata

Real-time infrastructure monitoring with metrics, logs, alerts, and ML-based anomaly detection.

NEnetdata/netdata82k近 7 天新增 123 个 star

Oh My Posh Validator

Validate oh-my-posh configurations and segment snippets against the official schema.

JAJanDeDobbeleer/oh-my-posh24k近 7 天新增 29 个 star

Coder

Manage Coder workspaces, templates, and cloud development environments

COcoder/coder18k近 7 天新增 57 个 star

docker-android

Android in docker solution with noVNC supported, video recording, mcp server and AI-agent

BUbudtmo/docker-android16k近 7 天新增 18 个 star

精选

Windows-MCP

控制 Windows 应用,操作文件和界面,执行 QA 测试。

CUCursorTouch/Windows-MCP12k近 7 天新增 286 个 star

pal-mcp-server

The power of Claude Code / GeminiCLI / CodexCLI + [Gemini / OpenAI / OpenRouter / Azure / Grok / Ollama / Custom Model / All Of The Above] working as one.

BEBeehiveInnovations/pal-mcp-server12k近 7 天新增 21 个 star