rxferrix-cli 0.10.2

The `rxferrix` command: scaffolds new RxFerrix apps (`rxferrix new`) and runs them in development (`rxferrix dev`)
rxferrix-cli-0.10.2 is not a library.

RxFerrix

RxFerrix is a Rust backend framework for apps that need live data. Define tables and functions in Rust, generate a typed TypeScript API, and subscribe to it from React, Svelte 5, or the core JavaScript client.

When a mutation changes data a query read, the server updates the query's subscribers. You do not write polling or cache invalidation code. SQLite, authentication, file storage, background jobs, search, and an admin dashboard run inside the app's server process.

Documentation · Get started · How it works

Run your first app

Install Rust and Bun, then create a project:

cargo install rxferrix-cli
rxferrix new my-app
cd my-app
rxferrix dev

In a second terminal, from my-app:

cd web
bun install
bun run dev

Open http://localhost:5173 in two tabs. Add a task in one; both lists update. The backend listens at http://127.0.0.1:8090. Its dashboard is at http://127.0.0.1:8090/_/; use the setup link printed by the server to create the first administrator.

React is the default. Use rxferrix new my-app --web svelte for Svelte 5, or --web none for a backend only.

rxferrix creates projects. Commands such as serve, codegen, and backup belong to your app's binary: during development, run them as cargo run -- <command>.

Write the backend

The generated app includes this pattern in src/tasks.rs:

use rxferrix::prelude::*;

#[table(name = "tasks")]
pub struct Task {
    pub text: String,
    pub done: bool,
}

#[query]
pub async fn list(ctx: &QueryCtx) -> Result<Vec<Doc<Task>>> {
    ctx.db.query::<Task>().order(Order::Desc).take(100).await
}

#[mutation]
pub async fn add(ctx: &MutationCtx, text: String) -> Result<Id<Task>> {
    let text = text.trim().to_string();
    ensure_user!(!text.is_empty(), "empty_text", "A task needs some text");
    ctx.db.insert(Task { text, done: false }).await
}

Declare mod tasks; in src/main.rs, then start the framework with rxferrix::RxFerrix::new().run(). Compiled modules register their tables and functions automatically.

Function Use it for
#[query] Read a consistent database snapshot; clients can subscribe to the result.
#[mutation] Validate and write data in one transaction.
#[action] Call an external API, send email, or coordinate separate queries and mutations.

Use it from the frontend

The generated React app already creates a client and wraps the component tree in RxFerrixProvider. Inside that tree:

import { useState } from "react";
import { useMutation, useQuery } from "@rxferrix/react";
import { api } from "./rxferrix";

export function TaskList() {
  const tasks = useQuery(api.tasks.list);
  const add = useMutation(api.tasks.add);
  const [error, setError] = useState<string | null>(null);

  async function addTask() {
    try {
      await add({ text: "Buy milk" });
      setError(null);
    } catch (error) {
      setError(error instanceof Error ? error.message : String(error));
    }
  }

  if (tasks === undefined) return <p>Loading…</p>;
  return (
    <>
      <button onClick={addTask}>Add task</button>
      {error && <p>{error}</p>}
      <ul>{tasks.map((task) => <li key={task._id}>{task.text}</li>)}</ul>
    </>
  );
}

Query failures go to a React error boundary; status hooks let you render them inline.

rxferrix dev runs cargo run -- serve --dev and rebuilds and restarts the backend when you save Rust code. The generated app's configuration writes the client API to web/src/rxferrix on every start, so changed functions and types reach the frontend too. Keep generated files generated.

Choose the next guide

You want to… Read
Understand queries, transactions, and subscriptions Core concepts
Add tables, indexes, pagination, and errors Functions and data
Connect a UI or JavaScript client Clients
Add sign-in and protect data Authentication and authorization
Upload files File storage
Schedule work or coordinate durable steps Scheduler, workflows
Search, count, or report on data Search, aggregates, analytics
Change a stored schema Migrations
Run an app in production Deploying, backups

A deployment uses one active server process and a data directory on local disk. Frontend assets can be embedded in the binary. RxFerrix does not distribute the live database across multiple active servers, and client reconnects do not provide persistent offline storage. Read behavior and limits before designing around these guarantees.

Explore the examples

  • Todo: Svelte 5, live queries, uploads, search, delayed jobs, and a migration.
  • Chat: React, sign-in, channel permissions, pagination, optimistic updates, search, aggregates, and optional analytics.

For framework development, repository layout, tests, and releases, see Contributing. The detailed Rust API contract, wire protocol, and design describe the implementation.