lunorash is the umbrella package for the base of a Lunora app. It re-exports
the server authoring API, the worker runtime, the Durable Objects, the values
suite, and the browser client through subpaths, and ships the lunora CLI
binary. Depend on it instead of wiring up @lunora/server, @lunora/values,
@lunora/runtime, @lunora/do, @lunora/client, and @lunora/cli
separately.
The npm name is lunorash because the unscoped lunora name is taken on npm. The CLI binary and the import subpaths stay lunora / lunorash/*.
Install
pnpm add lunorashFramework adapters (@lunora/react, @lunora/vue, @lunora/solid,
@lunora/svelte, @lunora/astro), the Vite plugin (@lunora/vite), and
add-ons (@lunora/auth, @lunora/mail, @lunora/storage, …) stay as separate
installs.
Subpaths
Every subpath the package publishes, in full — package.json's exports is the
source of truth, and __tests__/exports-map.test.ts holds it, the built dist/,
and the sources together.
| Import | Re-exports | Use |
|---|---|---|
lunorash / lunorash/server | @lunora/server | defineSchema, defineTable, initLunora, cronJobs, … |
lunorash/server/types | @lunora/server/types | server context and data-model types |
lunorash/server/data-model | @lunora/server/data-model | data-model type helpers |
lunorash/server/drizzle | @lunora/server/drizzle | the Drizzle table builders |
lunorash/server/rls/testing | @lunora/server/rls/testing | RLS policy test helpers |
lunorash/server/otel | @lunora/server/otel | OpenTelemetry helpers for server code |
lunorash/values | @lunora/values | the v.* validator suite |
lunorash/errors | @lunora/errors | LunoraError, the error catalog, toErrorBody |
lunorash/runtime | @lunora/runtime | createWorker, composeWorker, the query coordinator |
lunorash/do | @lunora/do | ShardDO / SessionDO |
lunorash/platform | @lunora/platform | Host contracts (ShardHost, SocketHost, …) |
lunorash/observability | @lunora/observability | Telemetry: logs, metrics, traces, issues |
lunorash/ratelimit | @lunora/ratelimit | rateLimit() middleware, RateLimiter, createDbStore |
lunorash/flags | @lunora/flags | feature flags: defineFlags, evaluation |
lunorash/flags/env | @lunora/flags/providers/env | flags backed by environment variables |
lunorash/flags/flagship | @lunora/flags/providers/flagship | flags backed by Cloudflare Flagship |
lunorash/flags/memory | @lunora/flags/providers/memory | in-memory flag provider (tests, local dev) |
lunorash/flags/web | @lunora/flags/web | the browser-side flag reader |
lunorash/client | @lunora/client | the browser SDK (LunoraClient, preloadQuery, …) |
lunorash/client/query | @lunora/client/query | the query/subscription primitives |
lunorash/client/auth | @lunora/client/auth | client-side auth wiring |
lunorash/client/pagination | @lunora/client/pagination | paginated-query helpers |
lunorash/client/ssr | @lunora/client/ssr | SSR preload / hydration |
lunorash/client/upload | @lunora/client/upload | direct-to-storage uploads |
lunorash/client/service | @lunora/client/service | the service (server-to-server) client |
lunorash/client/admin | @lunora/client/admin | LunoraAdminClient, the admin client |
The default entry (lunorash) mirrors lunorash/server, so
import { defineSchema } from "lunorash" works out of the box.
Authoring a schema
// lunora/schema.ts
import { defineSchema, defineTable } from "lunorash/server";
import { v } from "lunorash/values";
export default defineSchema({
messages: defineTable({
body: v.string(),
author: v.id("users"),
}).index("by_author", ["author"]),
});Procedure builders come from codegen, not the package
The query, mutation, action, internalQuery, internalMutation, and
internalAction builders are emitted into your app's _generated/server module
by lunora codegen: they are typed against your schema, so they are not exported
from lunorash/server. definePolicy is exported from lunorash/server too, but
the copy in _generated/server is bound to your schema's types.
// lunora/messages.ts
import { query, mutation } from "@/lunora/_generated/server";
import { v } from "lunorash/values";
export const list = query.input({ author: v.id("users") }).query(async ({ ctx, args: { author } }) =>
ctx.db
.query("messages")
.withIndex("by_author", (q) => q.eq("author", author))
.collect(),
);
export const send = mutation
.input({ body: v.string(), author: v.id("users") })
.mutation(async ({ ctx, args: { body, author } }) => ctx.db.insert("messages", { body, author }));When a project depends on lunorash, codegen emits lunorash/* imports in the
_generated/* files (including lunorash/client for FunctionReference)
instead of @lunora/*. Projects on the granular @lunora/* packages are
unchanged.
Worker entry
The worker entry builds the worker on the first request, using the SHARD
Durable Object binding from env:
// src/worker.ts
import { createWorker, type ExecutionContextLike, type LunoraWorker } from "lunorash/runtime";
export { ShardDO } from "lunorash/do";
let worker: LunoraWorker | undefined;
export default {
async fetch(request: Request, env: Env, ctx: ExecutionContextLike): Promise<Response> {
worker ??= createWorker({ shardDO: env.SHARD });
return worker.fetch(request, env, ctx);
},
};CLI
The lunora binary delegates to @lunora/cli, so installing lunorash alone
gives you the full CLI:
pnpm exec lunora dev
pnpm exec lunora codegen
pnpm exec lunora deploySee the getting started guide and the concepts section for the full authoring model.