Rex Documentation

Quickstart

Get a Rex app running in under a minute. No package.json or npm install required — Rex embeds React and extracts it automatically.

Install Rex

curl -fsSL https://raw.githubusercontent.com/limlabs/rex/main/install.sh | sh

Or via npm: npx @limlabs/rex init my-app (one-shot, no global install needed).

Create a new project

rex init my-app
cd my-app
rex dev

That's it. Rex scaffolds a starter page and the dev server handles the rest.

Start from scratch

You can also create a project by hand — just add a page:

mkdir my-app && cd my-app
mkdir pages

Create pages/index.tsx:

export default function Home() {
  return (
    <div>
      <h1>Hello from Rex!</h1>
      <p>Your Rust-powered React app is running.</p>
    </div>
  );
}

Start the dev server

rex dev

Open http://localhost:3000 to see your page.

Add another page

Create pages/about.tsx:

import React from "react";
import Link from "rex/link";

export default function About() {
  return (
    <div>
      <h1>About</h1>
      <p>This is the about page.</p>
      <Link href="/">Back home</Link>
    </div>
  );
}

Rex uses file-system routing — every file in pages/ becomes a route automatically.

Add server-side data

import React from "react";

export async function getServerSideProps() {
  return {
    props: {
      timestamp: new Date().toISOString(),
    },
  };
}

export default function Dashboard({ timestamp }: { timestamp: string }) {
  return <p>Server time: {timestamp}</p>;
}

Next steps