Quickstart
Scaffold a Rayfin project, sign in to Fabric, run the local development loop, and deploy the app with rayfin up.
Create a Rayfin app, run it against a managed Fabric backend, and publish the static frontend. You need a supported Node.js version and a Fabric account; the default template needs Node.js 22.13 or later.
Create a new Rayfin app named my-app with `npm create @microsoft/rayfin@latest my-app -- --template blankapp` (on Windows PowerShell, use `npm.cmd` instead of `npm` if the flag does not reach Rayfin). Install dependencies, run `npx rayfin login`, start the development loop with `npm run dev`, and report the local frontend URL. Then deploy the static build with `npx rayfin up` and confirm the live hosting URL with `npx rayfin up status`.Tip
Prefer a desktop app to a terminal? Fabricator is a Copilot harness that helps you build Rayfin apps. It creates the project, deploys it to Fabric, and lets you build the app by chatting with GitHub Copilot while a live preview updates. It runs on Windows and on macOS (Apple Silicon). Fabricator is a free, open-source community project, not a Microsoft product.
1. Scaffold a project
npm create @microsoft/rayfin@latest my-app
cd my-app
npm installThe project name is positional. The CLI asks How would you like to start?: choose โจ Use default template for the Universal App, or ๐ฆ Use a template (built-in) to pick another bundled template. To skip the prompt, pass a template ID after --:
npm create @microsoft/rayfin@latest my-app -- --template blankappOn Windows PowerShell, some npm and Node.js versions drop the -- separator, so the flag never reaches Rayfin. Run the same command with npm.cmd instead of npm.
List the template IDs your CLI version ships:
npx @microsoft/create-rayfin@latest --list-templatesRayfin 2.0 ships the same four bundled templates as 1.36:
| Template | Use it when |
|---|---|
blankapp | You want the default starter, the Universal App workspace with capability packs. Changed in 1.36 It follows the system light or dark theme unless the app or the Fabric host sets one. Changed in 2.0 |
dataapp | You are starting from the Fabric analytics app template. Rayfin fetches it from the microsoft/fabric-apps-analytic-templates repository at the v1 tag and falls back to the bundled copy if that source can't be loaded. |
todoapp | You want a data-enabled todo CRUD app with per-user access rules. See Build a todo app. |
gettingstartedauth | You want a Fabric-authenticated starter with getting-started UI. |
universal-app is hidden from the template list but accepted by name; use blankapp for the CLI-facing default. Every scaffold also installs agent context files, including AGENTS.md, that coding agents read before they change the project.
2. Sign in
npx rayfin loginThe command opens a browser for Microsoft Entra ID sign-in. Use --encryption-fallback-enabled only in development environments where the OS keychain is unavailable.
3. Run the development loop
npm run devSince Rayfin 1.35, every bundled template's npm run dev runs rayfin dev.
rayfin dev provisions or reuses the Fabric AppBackend, applies runtime settings and schema, writes RAYFIN_PUBLIC_* values to rayfin/.env and .env.local, then starts dev:frontend and local Functions when enabled. It does not publish static content.
4. Deploy the app
npx rayfin up
npx rayfin up statusrayfin up builds and deploys the production frontend, syncs rayfin.yml, applies schema changes, deploys Functions when enabled, and records deployment metadata in rayfin/.deployments.json and rayfin/.env. rayfin up status prints the hosting URL.
On later deploys, rayfin up skips the static upload when the built files and the deployment target have not changed since the last successful deploy. New in 2.0 See Deploy to Fabric.
Make your first data change
The default template starts with the data service turned off. From the project root, apply the data-modeling capability pack:
npm run pack:add -- data-modelingThe pack turns on services.data with the MSSQL dialect in rayfin/rayfin.yml, adds a starter Item entity in packages/data/src/Item.ts whose @role policy limits each row to its owner, registers it in packages/data/src/index.ts, adds its record type to packages/shared/src/index.ts, and installs dependencies.
Change the entity like any other class. This version adds an optional category field:
import {
boolean,
date,
entity,
role,
text,
uuid,
} from '@microsoft/rayfin-core';
@entity()
@role('authenticated', '*', {
policy: (claims, item) => claims.sub.eq(item.owner_id),
})
export class Item {
@uuid() id!: string;
@text({ min: 1, max: 200 }) title!: string;
@text({ optional: true, max: 2000 }) notes?: string;
@text({ optional: true, max: 50 }) category?: string;
@boolean({ default: false }) done!: boolean;
@date() createdAt!: Date;
@text({ max: 200 }) owner_id!: string;
}Add the same field to ItemRecord in packages/shared/src/index.ts, which types client.data.Item in the browser:
export interface ItemRecord {
id: string;
title: string;
notes?: string;
category?: string;
done: boolean;
createdAt: Date;
owner_id: string;
}
export type UniversalAppSchema = {
Item: ItemRecord;
};Restart npm run dev so rayfin dev applies the new schema to your development backend. When you are ready to publish, deploy it:
npx rayfin upEvery @text() field needs a max, and every entity needs an explicit permission decorator.
Next
- Project structure โ what the scaffold generated.
- Develop locally โ the
rayfin devworkflow. - Deploying with rayfin up โ deployment flags and metadata.