### Setup commands for local development Source: https://github.com/anolilab/lunora/blob/alpha/examples/chess/README.md Installs dependencies, copies the example environment file, creates a D1 database, and starts the dev server. Requires editing AUTH_SECRET in the copied .dev.vars file and pasting the D1 database id into wrangler.jsonc. ```bash pnpm install cp examples/chess/.dev.vars.example examples/chess/.dev.vars # then edit AUTH_SECRET wrangler d1 create lunora-example-chess # paste the id into wrangler.jsonc pnpm --filter @lunora-example/chess dev ``` -------------------------------- ### Setup commands for team-chat example Source: https://github.com/anolilab/lunora/blob/alpha/examples/team-chat/README.md Install dependencies, copy the .dev.vars example, create D1 and R2 resources, and start the dev server. Requires D1 (auth + profiles) and R2 (attachments). Fill in both secrets in .dev.vars and paste the D1 id into wrangler.jsonc. ```bash pnpm install cp examples/team-chat/.dev.vars.example examples/team-chat/.dev.vars # then fill in both secrets wrangler d1 create lunora-example-team-chat # paste the id into wrangler.jsonc wrangler r2 bucket create lunora-example-team-chat-files pnpm --filter @lunora-example/team-chat dev ``` -------------------------------- ### Install dependencies and run an example locally Source: https://github.com/anolilab/lunora/blob/alpha/examples/README.md Use pnpm to install dependencies and start the dev server for a specific example. Replace with the example's package name. The dev server prints a URL (http://localhost:5173 in the main checkout) to open in the browser. ```bash pnpm install pnpm --filter @lunora-example/ dev ``` -------------------------------- ### Setup commands for the blog example Source: https://github.com/anolilab/lunora/blob/alpha/examples/blog/README.md One-time setup: create the D1 database, R2 bucket, and secrets, then install and run the dev server. Paste the D1 database_id into wrangler.jsonc before running dev. ```bash # One-time setup pnpm dlx wrangler d1 create lunora-example-blog pnpm dlx wrangler r2 bucket create lunora-example-blog-files pnpm dlx wrangler secret put AUTH_SECRET pnpm dlx wrangler secret put STORAGE_SECRET # Paste the D1 database_id into wrangler.jsonc, then: pnpm install pnpm --filter @lunora-example/blog dev ``` -------------------------------- ### Install and run the example Source: https://github.com/anolilab/lunora/blob/alpha/examples/offline-rejections/README.md Install dependencies and start the Vite + Wrangler dev server in Miniflare. Open the URL printed by the dev server (http://localhost:5173 in the main checkout). ```bash pnpm install pnpm --filter @lunora-example/offline-rejections dev ``` -------------------------------- ### Install and start dev loop with bun Source: https://github.com/anolilab/lunora/blob/alpha/apps/docs/src/content/docs/getting-started.mdx After scaffolding, navigate into the project, install dependencies, and start the dev server using bun. The dev loop boots Vite and Wrangler in one terminal. ```bash cd my-app bun install bun run dev ``` -------------------------------- ### Quickstart commands for the SaaS template Source: https://github.com/anolilab/lunora/blob/alpha/templates/saas/README.md Install dependencies, copy the environment file, add the auth UI, and run the dev server. Requires setting BETTER_AUTH_SECRET in .dev.vars; billing keys are optional until used. ```bash pnpm install cp .dev.vars.example .dev.vars # then set BETTER_AUTH_SECRET: openssl rand -base64 32 pnpm exec lunora add auth-ui # the sign-in, sign-up and organization screens pnpm run dev ``` -------------------------------- ### Run the feedback board example locally Source: https://github.com/anolilab/lunora/blob/alpha/examples/feedback-board/README.md Installs dependencies and starts the dev server. The dev server prints a URL (http://localhost:5173 in the main checkout). Everything works offline in Miniflare except the Summarise button, which requires `wrangler login`. ```bash pnpm install ``` ```bash pnpm --filter @lunora-example/feedback-board dev ``` -------------------------------- ### Install and run dev server for @lunora-example/tanstack-start Source: https://github.com/anolilab/lunora/blob/alpha/examples/tanstack-start/README.md Installs dependencies and starts the development server. The dev server prints a URL (http://localhost:5173 in the main checkout) to open. ```bash pnpm install pnpm --filter @lunora-example/tanstack-start dev ``` -------------------------------- ### Install and start dev loop with npm Source: https://github.com/anolilab/lunora/blob/alpha/apps/docs/src/content/docs/getting-started.mdx After scaffolding, navigate into the project, install dependencies, and start the dev server using npm. The dev loop boots Vite and Wrangler in one terminal. ```bash cd my-app npm install npm run dev ``` -------------------------------- ### Run the kanban-board example locally with pnpm Source: https://github.com/anolilab/lunora/blob/alpha/examples/kanban-board/README.md Installs dependencies and starts the Vite + Wrangler dev server in Miniflare. Open the printed URL (http://localhost:5173 in the main checkout) in two windows and drag a card in one to see live updates. ```bash pnpm install pnpm --filter @lunora-example/kanban-board dev ``` -------------------------------- ### Install, codegen, test, and run the privacy example Source: https://github.com/anolilab/lunora/blob/alpha/examples/privacy/README.md Install dependencies, generate code, run tests, and start the dev server for the privacy example. The dev server prints a URL (http://localhost:5173 in the main checkout) to open. Sign-in uses email and password through @lunora/auth over a D1 database (DB in wrangler.jsonc); every privacy call needs that session. ```bash pnpm install pnpm --filter @lunora-example/privacy run codegen pnpm --filter @lunora-example/privacy run test pnpm --filter @lunora-example/privacy run dev ``` -------------------------------- ### Install and start dev loop with pnpm Source: https://github.com/anolilab/lunora/blob/alpha/apps/docs/src/content/docs/getting-started.mdx After scaffolding, navigate into the project, install dependencies, and start the dev server using pnpm. The dev loop boots Vite and Wrangler in one terminal. ```bash cd my-app pnpm install pnpm dev ``` -------------------------------- ### Install and run the todo app Source: https://github.com/anolilab/lunora/blob/alpha/examples/todo-app/README.md Install dependencies and start the dev server for the @lunora-example/todo-app package. The dev server runs Vite and Wrangler in Miniflare; open the printed URL (http://localhost:5173 in the main checkout). ```bash pnpm install pnpm --filter @lunora-example/todo-app dev ``` -------------------------------- ### Install and run the auth playground Source: https://github.com/anolilab/lunora/blob/alpha/examples/auth-playground/README.md Install dependencies and start the dev server with Vite and Wrangler in Miniflare. The dev server prints a URL (http://localhost:5173 in the main checkout). ```bash pnpm install pnpm --filter @lunora-example/auth-playground dev ``` -------------------------------- ### Run the realtime-cursors example Source: https://github.com/anolilab/lunora/blob/alpha/examples/realtime-cursors/README.md Install dependencies and start the dev server for the @lunora-example/realtime-cursors package. The server prints its port (http://localhost:5174 in the main checkout); append # to the URL to enter a different room (defaults to lobby). ```bash pnpm install pnpm --filter @lunora-example/realtime-cursors dev ``` -------------------------------- ### Run the chess example tests Source: https://github.com/anolilab/lunora/blob/alpha/examples/chess/README.md Runs the test suite for the chess example, covering the engine: legal move counts, pins, castling, en passant, promotion, checkmate detection, and notation. ```bash pnpm --filter @lunora-example/chess test ``` -------------------------------- ### Deploy the chess example with pnpm Source: https://github.com/anolilab/lunora/blob/alpha/examples/chess/README.md Deploys the chess example to Cloudflare Workers. Requires a checkout of the repository and the Cloudflare CLI configured. ```bash pnpm --filter @lunora-example/chess run deploy ``` -------------------------------- ### Install and start dev loop with yarn Source: https://github.com/anolilab/lunora/blob/alpha/apps/docs/src/content/docs/getting-started.mdx After scaffolding, navigate into the project, install dependencies, and start the dev server using yarn. The dev loop boots Vite and Wrangler in one terminal. ```bash cd my-app yarn install yarn dev ``` -------------------------------- ### Deploy command for @lunora-example/tanstack-start Source: https://github.com/anolilab/lunora/blob/alpha/examples/tanstack-start/README.md Deploys the example to Cloudflare Workers from a checkout. Requires the project to be installed and configured first. ```bash pnpm --filter @lunora-example/tanstack-start run deploy ``` -------------------------------- ### Install dependencies and start dev server Source: https://github.com/anolilab/lunora/blob/alpha/templates/analog/README.md Use your package manager to install dependencies and start the Vite dev server for AnalogJS. The placeholder represents your package manager (npm, pnpm, yarn, or bun). ```bash install run dev # vite dev server (AnalogJS) ``` -------------------------------- ### Initialize a new Lunora project with Vite React Source: https://github.com/anolilab/lunora/blob/alpha/packages/cli/skills/lunora-quickstart/SKILL.md Creates a new Lunora project using the React overlay (default framework) and installs dependencies. Use when starting a fresh app with `lunora init --vite `. ```bash lunora init my-app --vite react cd my-app pnpm install ``` -------------------------------- ### Install @lunora/replica with optional peers Source: https://github.com/anolilab/lunora/blob/alpha/packages/replica/docs/index.mdx Install the package. @lunora/server is an optional peer needed only when using EventLogDO; sql.js is an optional peer needed only when using LocalMirror in the browser. ```bash pnpm add @lunora/replica # @lunora/server is an optional peer — only needed when using EventLogDO: pnpm add @lunora/server # sql.js is an optional peer — only needed when using LocalMirror in the browser: pnpm add sql.js ``` -------------------------------- ### Install and run the services example with pnpm Source: https://github.com/anolilab/lunora/blob/alpha/examples/services/README.md Install dependencies and start the dev server for the @lunora-example/services app. The dev server prints the port; in a linked git worktree it derives its own port. The curl command posts an RPC request to the local server, expecting a JSON response with the summarised result. ```bash pnpm install pnpm --filter @lunora-example/services dev # 5173 in the main checkout; a linked git worktree derives its own port, which the dev server prints curl -X POST "http://localhost:${PORT:?set PORT to the port the dev server prints}/_lunora/rpc" \ -H 'content-type: application/json' \ -d '{"functionPath":"documents:summarise","args":{"prompt":"hi"}}' # {"result":{"completed":"completed hi","parsed":"/documents/7"}} ``` -------------------------------- ### Create LocalMirror with sql.js adapter Source: https://github.com/anolilab/lunora/blob/alpha/packages/replica/docs/getting-started.mdx Creates a LocalMirror using the sql.js adapter. Requires installing sql.js and initializing it with initSqlJs. The mirror is exported for use in other modules. ```ts // mirror.ts import initSqlJs from "sql.js"; import { createSqlJsAdapter, LocalMirror } from "@lunora/replica"; const SQL = await initSqlJs(); const database = new SQL.Database(); const adapter = createSqlJsAdapter(database); const mirror = new LocalMirror({ db: adapter }); export { mirror }; ``` -------------------------------- ### Local development setup commands Source: https://github.com/anolilab/lunora/blob/alpha/apps/playground/README.md Commands to install dependencies, copy the example secrets file, and start the dev server. The worker reads secrets from .dev.vars (gitignored, auto-loaded by @cloudflare/vite-plugin); without it the worker throws `AUTH_SECRET is required` on boot. Generate strong values with `openssl rand -hex 32`; see .dev.vars.example for the full list (AUTH_SECRET, AUTH_URL, STORAGE_SECRET, LUNORA_ADMIN_TOKEN). `vite dev` provides a local D1 by default, so no Cloudflare account is needed to iterate locally. ```bash pnpm install cp apps/playground/.dev.vars.example apps/playground/.dev.vars # then fill in the secrets pnpm --filter @lunora/playground dev ``` -------------------------------- ### Scaffold TanStack Start (Solid) app Source: https://github.com/anolilab/lunora/blob/alpha/apps/docs/src/content/docs/quickstarts.mdx Initializes a TanStack Start (Solid) server-rendered app as a single worker. ```bash lunora init app -t tanstack-start-solid ``` -------------------------------- ### createCheckout(input) Source: https://github.com/anolilab/lunora/blob/alpha/packages/payment/docs/index.mdx Starts a hosted checkout session for a payment or subscription. Returns a CheckoutResult containing the checkout URL. ```APIDOC ## createCheckout(input) ### Description Starts a hosted checkout session for a payment or subscription. Returns a CheckoutResult containing the checkout URL. ### Method createCheckout ### Parameters #### Input - **input** (object) - Required - Checkout input with `referenceId`, `priceId`, `mode` ("payment" | "subscription"), `successUrl`, `cancelUrl`, optional `idempotencyKey`, optional `expiresAt` (epoch ms). ### Returns - **CheckoutResult** - Contains a `url` for the hosted checkout. ### Request Example ```ts import { action, query, v } from "./_generated/server"; export const checkout = action.input({ priceId: v.string() }).action(async ({ ctx, args: { priceId } }): Promise<{ url: string }> => { const { url } = await ctx.payments.createCheckout({ referenceId: ctx.auth.userId, priceId, mode: "subscription", successUrl: "https://app.test/done", cancelUrl: "https://app.test/cancel", }); return { url }; }); ``` ``` -------------------------------- ### Create D1 database with wrangler d1 create Source: https://github.com/anolilab/lunora/blob/alpha/templates/saas/README.md Run this command before deploying to create the D1 database that better-auth persists into. Replace {{name}} with your database name and put the resulting database id in wrangler.jsonc's DB binding. ```bash wrangler d1 create {{name}}-db ``` -------------------------------- ### Deploy the feedback board example Source: https://github.com/anolilab/lunora/blob/alpha/examples/feedback-board/README.md Deploys the example to Cloudflare Workers. Requires a checkout of the repository and the secrets in `.dev.vars.example`. ```bash pnpm --filter @lunora-example/feedback-board run deploy ``` -------------------------------- ### createSubscription Source: https://github.com/anolilab/lunora/blob/alpha/packages/solid/docs/index.mdx Raw live stream as { data, error } accessors. "skip" tears down. ```APIDOC ## createSubscription ### Description Raw live stream as { data, error } accessors. "skip" tears down. ### Type Primitive ### Returns - **data** - Accessor - Subscription data. - **error** - Accessor - Subscription error. ``` -------------------------------- ### Solid usage example with LunoraProvider, createQuery, and createMutation Source: https://github.com/anolilab/lunora/blob/alpha/packages/solid/README.md Shows the basic setup for using Lunora with Solid. Imports the client and Solid primitives, creates a client with the current origin, and renders a Messages component that lists messages and sends new ones. The query returns undefined until the first server frame, then updates on every delta. The mutation provides a pending signal to disable the button while sending. ```tsx import { LunoraClient } from "@lunora/client"; import { LunoraProvider, createQuery, createMutation } from "@lunora/solid"; import { For, render } from "solid-js/web"; import { api } from "./lunora/_generated/api"; const client = new LunoraClient({ url: window.location.origin }); function Messages() { // `messages()` reads `undefined` until the first server frame, then updates on every delta. const messages = createQuery(api.messages.list, { channelId: "channel:demo" }); const send = createMutation(api.messages.send); return ( <> {(m) =>
  • {m.text}
  • }
    ); } render( () => ( ), document.getElementById("root")!, ); ``` -------------------------------- ### createQuery Source: https://github.com/anolilab/lunora/blob/alpha/packages/solid/docs/index.mdx Live query as a reactive accessor. Accessor args re-subscribe; "skip" short-circuits. ```APIDOC ## createQuery ### Description Live query as a reactive accessor. Accessor args re-subscribe; "skip" short-circuits. ### Type Primitive ### Options - **CreateQueryOptions** - Optional - Query options. ``` -------------------------------- ### Add the crons starter with lunora registry add Source: https://github.com/anolilab/lunora/blob/alpha/packages/cli/skills/lunora-setup-scheduler/SKILL.md Adds @lunora/server and @lunora/scheduler to package.json and copies lunora/crons.ts (a cronJobs() registry) and lunora/crons/jobs.ts (an example internalMutation, internal.crons.jobs.run) that you own. Run pnpm install afterward. ```bash lunora registry add crons pnpm install ``` -------------------------------- ### Install @lunora/workflow with yarn Source: https://github.com/anolilab/lunora/blob/alpha/packages/workflow/README.md Install the package using yarn. ```sh yarn add @lunora/workflow ``` -------------------------------- ### createInfiniteQuery Source: https://github.com/anolilab/lunora/blob/alpha/packages/solid/docs/index.mdx Infinite-scroll variant: { pages, status, hasNextPage, fetchNextPage, ... }. ```APIDOC ## createInfiniteQuery ### Description Infinite-scroll variant: { pages, status, hasNextPage, fetchNextPage, ... }. ### Type Primitive ### Returns - **pages** - Accessor - Pages of results. - **status** - Accessor - Query status. - **hasNextPage** - Accessor - Whether more pages exist. - **fetchNextPage** - Function - Fetch next page. ``` -------------------------------- ### pnpm minimumReleaseAge error example Source: https://github.com/anolilab/lunora/blob/alpha/apps/docs/src/content/docs/getting-started.mdx Example error shown when using pnpm's minimumReleaseAge with Lunora packages. The version 1.0.0-alpha.39 of @lunora/seed does not meet the constraint. ```text ERR_PNPM_NO_MATURE_MATCHING_VERSION Version 1.0.0-alpha.39 (released 2 hours ago) of @lunora/seed does not meet the minimumReleaseAge constraint ``` -------------------------------- ### Initialize Lunora in an existing app with --here Source: https://github.com/anolilab/lunora/blob/alpha/apps/docs/src/content/docs/quickstarts.mdx Run this command in the root of an existing project to detect the framework, patch its config, scaffold the lunora/ directory, and print the wiring steps. ```bash npx lunorash@alpha init --here ``` -------------------------------- ### Mobile Client Setup Commands (Expo) Source: https://github.com/anolilab/lunora/blob/alpha/examples/expo/README.md Commands to point the Expo app at the worker and start it. Use your machine's LAN IP or a tunnel because a device/simulator can't reach 'localhost'. Press i/a or scan the QR code after starting. ```sh # a device/simulator can't reach "localhost" — use your machine's LAN IP, # or a tunnel (e.g. `pnpm wrangler dev --ip 0.0.0.0` + your IP). export EXPO_PUBLIC_LUNORA_URL="http://:8787" pnpm start # then press i / a, or scan the QR ``` -------------------------------- ### Install dependencies and run the Clerk auth example Source: https://github.com/anolilab/lunora/blob/alpha/examples/clerk-auth/README.md Install dependencies and start the development server for the `@lunora-example/clerk-auth` package. The default dev port is 5173; in a linked git worktree `pnpm dev` may use a shifted port, which must be added to `CLERK_AUTHORIZED_PARTIES`. ```bash pnpm install pnpm --filter @lunora-example/clerk-auth dev ``` -------------------------------- ### Initialize and run a new Lunora app with pnpm Source: https://github.com/anolilab/lunora/blob/alpha/README.md Creates a new app with the alpha CLI, installs dependencies, and starts the dev server. The npm package is `lunorash`; the CLI command is `lunora`. Expect breaking changes until the first stable release. ```bash pnpm dlx lunorash@alpha init my-app cd my-app pnpm install pnpm dev ``` -------------------------------- ### Install @lunora/replica with SQLite backends Source: https://github.com/anolilab/lunora/blob/alpha/packages/replica/README.md Install the package and choose one SQLite backend. The optional @lunora/server is only needed for the EventLogDO. ```bash pnpm add @lunora/replica # Choose one SQLite backend: pnpm add sql.js # browser + Node (WASM) pnpm add better-sqlite3 # Node.js only (native) pnpm add @sqlite.org/sqlite-wasm # browser (official WASM) # @lunora/server is optional — needed only for the EventLogDO: pnpm add @lunora/server ``` -------------------------------- ### Deploy the kanban-board example with pnpm Source: https://github.com/anolilab/lunora/blob/alpha/examples/kanban-board/README.md Deploys the example from a checkout. The README warns this example has no authentication, so anyone with the URL can read, move, and delete cards; wire @lunora/auth and gate mutations on ctx.auth.userId before real use. ```bash pnpm --filter @lunora-example/kanban-board run deploy ``` -------------------------------- ### Install @lunora/replica and SQLite backends Source: https://github.com/anolilab/lunora/blob/alpha/packages/replica/docs/getting-started.mdx Install the package and choose a SQLite backend. The comments indicate sql.js works in browser and Node (WASM), @sqlite.org/sqlite-wasm is browser-only (official WASM), and better-sqlite3 is Node.js only (native). ```bash pnpm add @lunora/replica # Choose a SQLite backend: pnpm add sql.js # browser + Node (WASM) pnpm add @sqlite.org/sqlite-wasm # browser (official WASM) pnpm add better-sqlite3 # Node.js only (native) ``` -------------------------------- ### createPresence Source: https://github.com/anolilab/lunora/blob/alpha/packages/solid/docs/index.mdx Collaborative awareness: heartbeat + live present member list. ```APIDOC ## createPresence ### Description Collaborative awareness: heartbeat + live present member list. ### Type Primitive ``` -------------------------------- ### Install dependencies and run e2e tests Source: https://github.com/anolilab/lunora/blob/alpha/tests/e2e/README.md Quick start commands from the repo root. First run downloads Playwright browsers (~250 MB); subsequent runs reuse the local browser cache. ```bash # from repo root pnpm install pnpm e2e ``` -------------------------------- ### createAction Source: https://github.com/anolilab/lunora/blob/alpha/packages/solid/docs/index.mdx Action handle: { data, error, pending, call, reset } accessors. No optimistic options. ```APIDOC ## createAction ### Description Action handle: { data, error, pending, call, reset } accessors. No optimistic options. ### Type Primitive ### Returns - **data** - Accessor - Action result data. - **error** - Accessor - Action error. - **pending** - Accessor - Pending state. - **call** - Function - Trigger action. - **reset** - Function - Reset action state. ``` -------------------------------- ### Initialize a new Lunora app with lunorash Source: https://github.com/anolilab/lunora/blob/alpha/apps/docs/src/content/blog/introducing-lunora.mdx Run this command to create a typed, live-syncing app. After initialization, `pnpm dev` boots workerd, generates types, starts Vite, and reloads on save with a local Studio. ```bash pnpm dlx lunorash@alpha init my-app ``` -------------------------------- ### Install @lunora/workflow with pnpm Source: https://github.com/anolilab/lunora/blob/alpha/packages/workflow/README.md Install the package using pnpm. ```sh pnpm add @lunora/workflow ``` -------------------------------- ### Create LocalMirror with better-sqlite3 adapter Source: https://github.com/anolilab/lunora/blob/alpha/packages/replica/docs/getting-started.mdx Creates a LocalMirror using the better-sqlite3 adapter. Requires installing better-sqlite3 and creating an in-memory database. The mirror is exported for use in other modules. ```ts // mirror.ts import Database from "better-sqlite3"; import { createBetterSqlite3Adapter, LocalMirror } from "@lunora/replica"; const database = new Database(":memory:"); const adapter = createBetterSqlite3Adapter(database); const mirror = new LocalMirror({ db: adapter }); export { mirror }; ``` -------------------------------- ### createAuth Source: https://github.com/anolilab/lunora/blob/alpha/packages/solid/docs/index.mdx Identity plumbing: { status, token, user } signals + setToken. Gate on status. ```APIDOC ## createAuth ### Description Identity plumbing: { status, token, user } signals + setToken. Gate on status. ### Type Primitive ### Returns - **status** - Signal - Auth status. - **token** - Signal - Auth token. - **user** - Signal - User object. - **setToken** - Function - Set the auth token. ``` -------------------------------- ### Install dependencies and run the dev server Source: https://github.com/anolilab/lunora/blob/alpha/examples/workos-auth/README.md Install dependencies and start the example app. The dev server runs on port 5173 by default; in a linked git worktree pnpm dev prints a shifted port that must be registered as a redirect URI and CORS origin. ```bash pnpm install pnpm --filter @lunora-example/workos-auth dev ``` -------------------------------- ### Backend Setup Commands (Cloudflare Worker) Source: https://github.com/anolilab/lunora/blob/alpha/examples/expo/README.md Commands to set up the Cloudflare Worker backend: copy environment variables, create the D1 database, regenerate code, and start the dev server. Requires setting AUTH_SECRET and pasting the D1 database id into wrangler.jsonc. ```sh # from this folder cp .dev.vars.example .dev.vars # then set AUTH_SECRET (openssl rand -hex 32) pnpm wrangler d1 create lunora-expo-example # paste the id into wrangler.jsonc pnpm codegen # regenerate lunora/_generated pnpm dev:server # wrangler dev → http://localhost:8787 ``` -------------------------------- ### Deploy example from checkout with pnpm Source: https://github.com/anolilab/lunora/blob/alpha/examples/README.md Use these two commands to deploy a Lunora example from a local checkout when Cloudflare's deploy flow fails on dependency resolution. Replace with the example's package name. ```bash pnpm install pnpm --filter @lunora-example/ run deploy ``` -------------------------------- ### createRateLimit Source: https://github.com/anolilab/lunora/blob/alpha/packages/solid/docs/index.mdx Client-side rate-limit mirror: { ok, disabled, retryAfter, check, consume, reset }. ```APIDOC ## createRateLimit ### Description Client-side rate-limit mirror: { ok, disabled, retryAfter, check, consume, reset }. ### Type Primitive ### Returns - **ok** - Accessor - Whether request is allowed. - **disabled** - Accessor - Whether rate limiting is disabled. - **retryAfter** - Accessor - Retry after duration. - **check** - Function - Check if allowed. - **consume** - Function - Consume a request. - **reset** - Function - Reset rate limit. ``` -------------------------------- ### Scaffold a new Expo app with Lunora Source: https://github.com/anolilab/lunora/blob/alpha/apps/docs/src/content/docs/frameworks/react-native.mdx Initializes a new Expo app (iOS, Android, web) with a Lunora worker backend, auth, and live-chat example. Follow the generated README for D1 database setup, AUTH_SECRET, codegen, and expo start. ```sh lunora init my-app -t expo ``` -------------------------------- ### Install @lunora/hyperdrive and a driver Source: https://github.com/anolilab/lunora/blob/alpha/packages/cli/skills/lunora-setup-hyperdrive/SKILL.md Install the package and one optional peer driver. The driver is not bundled; choose based on placeholder style: postgres for fromPostgresJs ($1, $2), pg for fromNodePg ($1, $2), or mysql2 for fromMysql2 (?). SQL is never rewritten, so use the driver's native placeholders. ```bash pnpm add @lunora/hyperdrive pnpm add postgres # → fromPostgresJs ($1, $2 placeholders) # or: pnpm add pg → fromNodePg ($1, $2) # or: pnpm add mysql2 → fromMysql2 (?) ``` -------------------------------- ### createLiveTopic Source: https://github.com/anolilab/lunora/blob/alpha/packages/solid/docs/index.mdx One declared live topic (live.posts.post({ postId })): { lastEvent, error } accessors. Resubscribes on change. ```APIDOC ## createLiveTopic ### Description One declared live topic (live.posts.post({ postId })): { lastEvent, error } accessors. Resubscribes on change. ### Type Primitive ### Returns - **lastEvent** - Accessor - Last event received. - **error** - Accessor - Subscription error. ``` -------------------------------- ### Install @lunora/nuxt Source: https://github.com/anolilab/lunora/blob/alpha/packages/nuxt/README.md Install the Nuxt module for Lunora via npm. ```bash npm install @lunora/nuxt ``` -------------------------------- ### createActionForClient Source: https://github.com/anolilab/lunora/blob/alpha/packages/solid/docs/index.mdx Build an action handle bound to an explicit client (test/internal seam). ```APIDOC ## createActionForClient ### Description Build an action handle bound to an explicit client (test/internal seam). ### Type Primitive ### Parameters - **client** (ActionClient) - Required - The client to bind. ``` -------------------------------- ### Install dependencies and start development server Source: https://github.com/anolilab/lunora/blob/alpha/templates/vinext-pages/README.md Run `pnpm install` to install dependencies, then `pnpm dev` to start the development server. `pnpm dev` runs `vinext dev` with the `@cloudflare/vite-plugin`, so the Next.js app and Lunora worker share one origin locally. ```bash pnpm install pnpm dev ``` -------------------------------- ### Install with yarn Source: https://github.com/anolilab/lunora/blob/alpha/packages/server/README.md Install the @lunora/server package using yarn. ```sh yarn add @lunora/server ``` -------------------------------- ### Generate types and start worker Source: https://github.com/anolilab/lunora/blob/alpha/templates/expo/README.md Generate Lunora types and start the worker, which defaults to http://localhost:8787. ```bash run codegen run dev:server ``` -------------------------------- ### createMutation Source: https://github.com/anolilab/lunora/blob/alpha/packages/solid/docs/index.mdx Optimistic mutation handle: { data, error, pending, mutate, reset } accessors. ```APIDOC ## createMutation ### Description Optimistic mutation handle: { data, error, pending, mutate, reset } accessors. ### Type Primitive ### Returns - **data** - Accessor - Mutation result data. - **error** - Accessor - Mutation error. - **pending** - Accessor - Pending state. - **mutate** - Function - Trigger mutation. - **reset** - Function - Reset mutation state. ``` -------------------------------- ### Scaffold TanStack Start (React) app Source: https://github.com/anolilab/lunora/blob/alpha/apps/docs/src/content/docs/quickstarts.mdx Initializes a TanStack Start (React) server-rendered app as a single worker. ```bash lunora init app -t tanstack-start-react ``` -------------------------------- ### Start the app Source: https://github.com/anolilab/lunora/blob/alpha/templates/expo/README.md Start the Expo app in a second terminal. Press i/a/w for iOS/Android/web, or target a platform directly. ```bash run start # then press i / a / w for iOS / Android / web # or target one platform directly: run ios run android run web ``` -------------------------------- ### createMutationForClient Source: https://github.com/anolilab/lunora/blob/alpha/packages/solid/docs/index.mdx Build a mutation handle bound to an explicit client (test/internal seam). ```APIDOC ## createMutationForClient ### Description Build a mutation handle bound to an explicit client (test/internal seam). ### Type Primitive ### Parameters - **client** (MutationClient) - Required - The client to bind. ``` -------------------------------- ### Install dependencies Source: https://github.com/anolilab/lunora/blob/alpha/templates/expo/README.md Install project dependencies using your preferred package manager (npm, pnpm, yarn, or bun). ```bash install ``` -------------------------------- ### Start a workflow instance from context Source: https://github.com/anolilab/lunora/blob/alpha/registry/workflow/README.md Resolves the workflow handle with `get()` and starts an instance with `create()`. `instance.status()` returns the current status. ```ts const instance = await ctx.workflows.get("orderPipeline").create({ params: { orderId: "ord_123" } }); const status = await instance.status(); ``` -------------------------------- ### createPaginatedQuery Source: https://github.com/anolilab/lunora/blob/alpha/packages/solid/docs/index.mdx Cursor pagination: { results, status, isLoading, loadMore, error }. ```APIDOC ## createPaginatedQuery ### Description Cursor pagination: { results, status, isLoading, loadMore, error }. ### Type Primitive ### Returns - **results** - Accessor - Paginated results. - **status** - Accessor - Query status. - **isLoading** - Accessor - Loading state. - **loadMore** - Function - Load next page. - **error** - Accessor - Query error. ``` -------------------------------- ### createActionForClient(client, fn) Source: https://github.com/anolilab/lunora/blob/alpha/packages/solid/docs/index.mdx Builds the same ActionHandle as createAction but bound to an explicit client object. Only `{ action }` is required on the client. ```APIDOC ## createActionForClient(client, fn) ### Description Builds the same handle as `createAction` bound to an explicit client object (only `{ action }` is required), the seam behind `createAction`. ### Parameters - **client** (object) - Required - Client object with an `action` property. - **fn** (function) - Required - The action function to wrap. ### Returns - **ActionHandle** - Same shape as `createAction`. ``` -------------------------------- ### Install dependencies and start dev server Source: https://github.com/anolilab/lunora/blob/alpha/templates/rspack-react/README.md Use your package manager (`npm`, `pnpm`, `yarn`, or `bun`) to install dependencies and run the dev server. `rsbuild dev` serves the React app and starts the Lunora Worker with `wrangler dev`, proxying `/_lunora/*` to it. ```bash install run dev ``` -------------------------------- ### createServerClient Source: https://github.com/anolilab/lunora/blob/alpha/packages/solid/docs/index.mdx Creates a server-side client for preloading queries. It is safe to import from a SolidStart "use server" route loader and should be created per request to avoid token leakage. ```APIDOC ## createServerClient ### Description Creates a server-side client for preloading queries. It is safe to import from a SolidStart "use server" route loader and should be created per request to avoid token leakage. ### Method Function ### Signature `createServerClient(options)` ### Parameters - **options** (object) - Required - Configuration object - **url** (string) - Required - The LUNORA_URL environment variable - **token** (string) - Required - Authentication token ### Returns - **client** - The server client instance ### Request Example ```ts import { createServerClient } from "@lunora/solid/server"; const client = createServerClient({ url: process.env.LUNORA_URL!, token }); ``` ``` -------------------------------- ### Install @better-auth/sso for enterprise SSO Source: https://github.com/anolilab/lunora/blob/alpha/packages/auth/docs/index.mdx Install the optional peer package `@better-auth/sso` to enable the `sso` plugin. This package is not included by default because it statically imports `samlify` and its dependencies, adding ~1.1 MB to your install. ```Shell pnpm add @better-auth/sso ``` -------------------------------- ### Run lunora init interactively or with -t template flag Source: https://github.com/anolilab/lunora/blob/alpha/apps/docs/src/content/docs/quickstarts.mdx Scaffolds a complete Lunora project with a worker, schema, query, mutation, and client wiring. Use no flags for the interactive picker or pass -t to select a template directly (e.g., -t next). ```bash npx lunorash@alpha init my-app # interactive picker npx lunorash@alpha init my-app -t next # straight to a template ``` -------------------------------- ### lunora init commands for scaffolding new projects Source: https://github.com/anolilab/lunora/blob/alpha/apps/docs/src/content/docs/frameworks/bring-your-framework.mdx Scaffold a new project with `lunora init`. The `-t tanstack-start-react` template is fully wired with the framework SSR handler as the worker's `httpRouter`, a sample live loader route, and the `@lunora/react` provider. The `--vite react` option is the default and creates a React SPA via create-vite overlay. The `-t standalone` option creates a worker-only project with no frontend. ```bash lunora init my-app -t tanstack-start-react # class A — proven, with a live-loader route lunora init my-app --vite react # React SPA (create-vite overlay) — the default lunora init my-app -t standalone # worker-only, no frontend ``` -------------------------------- ### Scaffold TanStack Start (React, Rsbuild) app Source: https://github.com/anolilab/lunora/blob/alpha/apps/docs/src/content/docs/quickstarts.mdx Initializes a TanStack Start (React, Rsbuild) server-rendered app with SSR composed into the Lunora worker. ```bash lunora init app -t tanstack-start-react-rspack ``` -------------------------------- ### Install with npm Source: https://github.com/anolilab/lunora/blob/alpha/packages/server/README.md Install the @lunora/server package using npm. ```sh npm install @lunora/server ``` -------------------------------- ### Install @lunora/payment and dodopayments with bun Source: https://github.com/anolilab/lunora/blob/alpha/packages/payment/docs/dodopayments.mdx Adds the payment package and the Dodo SDK as an optional peer dependency using bun. ```bash bun add @lunora/payment dodopayments ``` -------------------------------- ### stream() Source: https://github.com/anolilab/lunora/blob/alpha/sdks/python/README.md Starts a stream loop. The loop ends when `client.close()` is called. ```APIDOC ## stream() ### Description Starts a stream loop. The loop ends when `client.close()` is called. ### Method `stream()` ### Behavior - The loop ends when `client.close()` is called. ``` -------------------------------- ### Set up LunoraProvider with LunoraClient in SolidJS Source: https://github.com/anolilab/lunora/blob/alpha/packages/solid/docs/index.mdx Initializes a LunoraClient and wraps the app in LunoraProvider for SolidJS. Requires a generated API module and an App component. The client connects to the current origin. ```tsx import { LunoraClient } from "@lunora/client"; import { LunoraProvider } from "@lunora/solid"; import { render } from "solid-js/web"; import { api } from "./lunora/_generated/api"; import App from "./App"; const client = new LunoraClient({ url: window.location.origin }); render( () => ( ), document.getElementById("root")!, ); ``` -------------------------------- ### Install dependencies and start dev server with Lunora CLI Source: https://github.com/anolilab/lunora/blob/alpha/templates/astro/README.md Run these commands in the project root to install dependencies and start the dev server. `lunora dev` runs `astro dev` and keeps Lunora generated files, Studio, and dev state in sync. Bare ` run dev` also works as it runs the same `astro dev`. ```bash install exec lunora dev ``` -------------------------------- ### Install @lunora/advisor with yarn Source: https://github.com/anolilab/lunora/blob/alpha/packages/advisor/README.md Install the package using yarn. ```sh yarn add @lunora/advisor ``` -------------------------------- ### LunoraContext Source: https://github.com/anolilab/lunora/blob/alpha/packages/solid/docs/index.mdx The underlying Solid context, for advanced manual useContext. ```APIDOC ## LunoraContext ### Description The underlying Solid context, for advanced manual useContext. ### Type Context ``` -------------------------------- ### runInitCommand Source: https://github.com/anolilab/lunora/blob/alpha/api-snapshots/cli.api.md Runs the init command. ```APIDOC ## runInitCommand ### Description Runs the init command. ### Signature ```ts const runInitCommand: (options: InitCommandOptions) => Promise; ``` ### Parameters - **options** (InitCommandOptions) - Required - The options for the init command. ### Returns - **Promise** - The result of the init command. ``` -------------------------------- ### Deploy team-chat example with pnpm Source: https://github.com/anolilab/lunora/blob/alpha/examples/team-chat/README.md Deploys the team-chat example from a checkout. Requires the repository to be cloned and dependencies installed. The deploy command provisions the Durable Object namespace, D1 database, and R2 bucket, and prompts for secrets from `.dev.vars.example`. ```bash pnpm --filter @lunora-example/team-chat run deploy ``` -------------------------------- ### Install payment registry Source: https://github.com/anolilab/lunora/blob/alpha/registry/payment/README.md Adds the payment registry to your Lunora project. It installs @lunora/payment, @lunora/server, and stripe, copies the payment functions into your project, scaffolds environment variables, and declares APP_BASE_URL in wrangler.jsonc vars. ```bash lunora registry add payment ``` -------------------------------- ### pnpm-workspace.yaml minimumReleaseAgeExclude Source: https://github.com/anolilab/lunora/blob/alpha/apps/docs/src/content/docs/getting-started.mdx Configuration to exclude the @lunora scope and lunorash from pnpm's minimumReleaseAge constraint, preventing resolution failures. ```yaml # pnpm-workspace.yaml minimumReleaseAge: 1440 minimumReleaseAgeExclude: - "@lunora/*" - lunorash ``` -------------------------------- ### useLunora Source: https://github.com/anolilab/lunora/blob/alpha/packages/solid/docs/index.mdx Reads the LunoraClient from the nearest LunoraProvider. Throws if none is mounted. ```APIDOC ## useLunora ### Description Reads the LunoraClient from the nearest LunoraProvider. Throws if none is mounted. ### Type Function ### Returns - **LunoraClient** - The client from context. ``` -------------------------------- ### Copy environment files for Clerk setup Source: https://github.com/anolilab/lunora/blob/alpha/examples/clerk-auth/README.md Run these commands to copy the example environment files. `.dev.vars` is read by the Worker and `.env.local` by the browser bundle. The variables are not secrets; tokens are verified against Clerk's public JWKS. ```bash cp .dev.vars.example .dev.vars # read by the Worker cp .env.example .env.local # read by the browser bundle ``` -------------------------------- ### Install expo-crypto polyfill Source: https://github.com/anolilab/lunora/blob/alpha/apps/docs/src/content/docs/frameworks/react-native.mdx Install the expo-crypto package via Expo CLI to provide WebCrypto APIs (crypto.randomUUID/getRandomValues) required by @tanstack/db's safeRandomUUID. Without this polyfill, @lunora/db throws at setup or the first write fails with 'No secure random number generator available'. ```bash npx expo install expo-crypto ``` -------------------------------- ### Install with yarn Source: https://github.com/anolilab/lunora/blob/alpha/packages/ai/README.md Install the @lunora/ai package using yarn. ```sh yarn add @lunora/ai ``` -------------------------------- ### createConnectionStatus Source: https://github.com/anolilab/lunora/blob/alpha/packages/solid/docs/index.mdx Reactive accessor of the live-socket ConnectionStatus. ```APIDOC ## createConnectionStatus ### Description Reactive accessor of the live-socket ConnectionStatus. ### Type Primitive ``` -------------------------------- ### Set cache headers on an httpRoute Source: https://github.com/anolilab/lunora/blob/alpha/packages/server/README.md Set cache headers declaratively on an httpRoute using cacheControl and cacheTag. This example defines a GET route for /api/products/:id. ```ts import { httpRoute, v } from "@lunora/server"; export const getProduct = httpRoute .get("/api/products/:id") .params({ id: v.string() }) .cacheControl("public, max-age=300, stale-while-revalidate=3600") .cacheTag("products") .handler(async ({ ctx, params }) => { return { id: params.id, name: "Widget" }; }); ``` -------------------------------- ### Measure startup CPU locally with lunora build, wrangler check startup, and lunora analyze Source: https://github.com/anolilab/lunora/blob/alpha/apps/docs/src/content/docs/startup-cpu-limit.mdx Run these commands in order to write the bundle and bundle-meta.json, generate worker-startup.cpuprofile, and list the heaviest modules. Cloudflare's CPU is slower than a laptop, so treat anything above a few hundred milliseconds locally as a warning. Timings vary between runs (garbage collection can be a third of the total), so take several runs and compare medians. ```bash lunora build --out-dir .lunora/build # writes the bundle and bundle-meta.json npx wrangler check startup # writes worker-startup.cpuprofile (run it in an app whose `main` is the Worker entry) lunora analyze # the heaviest modules in the bundle ``` -------------------------------- ### Per-instance images and snapshots with schedulingPolicy durable_object Source: https://github.com/anolilab/lunora/blob/alpha/packages/container/README.md Use schedulingPolicy: "durable_object" to let each instance pick its image and size at start, and save/restore its filesystem. The example shows defining the container, starting with a specific image and instance type, and restoring from a snapshot. ```TypeScript export const agentComputer = defineContainer({ schedulingPolicy: "durable_object", images: { base: "./containers/base" }, image: "base", }); const computer = ctx.containers.agentComputer.get(taskId); await computer.start({ image: "base", instanceType: "standard-2" }); const saved = await computer.snapshot(); await ctx.containers.agentComputer.get(otherId).start({ snapshot: saved }); ``` -------------------------------- ### Initialize Lunora in an existing app with lunora init --here Source: https://github.com/anolilab/lunora/blob/alpha/packages/cli/skills/lunora-quickstart/SKILL.md Run inside an existing app to detect the framework from package.json, scaffold lunora/schema.ts and lunora/messages.ts (skipped if a schema exists), and patch or create the Vite config with the lunora() plugin. SvelteKit, Nuxt, and Astro wire Lunora through their server entry instead, leaving the Vite config untouched. The CLI prints framework-specific next steps and does not edit framework-owned files. ```bash lunora init --here ``` -------------------------------- ### Query locally with mirror.query Source: https://github.com/anolilab/lunora/blob/alpha/packages/replica/docs/getting-started.mdx Runs a SQL query against the local mirror. The query selects incomplete todos and passes a parameter for the done flag. ```ts const todos = mirror.query<{ id: string; title: string; done: boolean }>("SELECT id, title, done FROM todos WHERE done = ?", [false]); ``` -------------------------------- ### Deploy with bun Source: https://github.com/anolilab/lunora/blob/alpha/apps/docs/src/content/docs/getting-started.mdx Deploys the Worker using bun. Runs codegen, validates wrangler.jsonc, and calls wrangler deploy. Data migrations run only with --migrate. ```bash bun run lunora deploy ``` -------------------------------- ### Deploy with yarn Source: https://github.com/anolilab/lunora/blob/alpha/apps/docs/src/content/docs/getting-started.mdx Deploys the Worker using yarn. Runs codegen, validates wrangler.jsonc, and calls wrangler deploy. Data migrations run only with --migrate. ```bash yarn lunora deploy ``` -------------------------------- ### Install @lunora/queue with bun Source: https://github.com/anolilab/lunora/blob/alpha/packages/queue/docs/index.mdx Install the package using bun. ```bash bun add @lunora/queue ``` -------------------------------- ### Deploy with npm Source: https://github.com/anolilab/lunora/blob/alpha/apps/docs/src/content/docs/getting-started.mdx Deploys the Worker using npm. Runs codegen, validates wrangler.jsonc, and calls wrangler deploy. Data migrations run only with --migrate. ```bash npx lunora deploy ``` -------------------------------- ### Install @lunora/react with bun Source: https://github.com/anolilab/lunora/blob/alpha/apps/docs/src/content/docs/frameworks/react.mdx Install the React binding using bun. ```sh bun add @lunora/react ``` -------------------------------- ### Install @lunora/advisor with pnpm Source: https://github.com/anolilab/lunora/blob/alpha/packages/advisor/README.md Install the package using pnpm. ```sh pnpm add @lunora/advisor ``` -------------------------------- ### Install with pnpm Source: https://github.com/anolilab/lunora/blob/alpha/packages/server/README.md Install the @lunora/server package using pnpm. ```sh pnpm add @lunora/server ``` -------------------------------- ### Install @lunora/react with npm Source: https://github.com/anolilab/lunora/blob/alpha/apps/docs/src/content/docs/frameworks/react.mdx Install the React binding using npm. ```sh npm install @lunora/react ```