rayfin init
Scaffold a new Rayfin project, add Rayfin to an existing directory, select templates, and choose services with rayfin init.
Use rayfin init to create or update rayfin/rayfin.yml. Use
npm create @microsoft/rayfin@latest when you want the same initializer wrapped in npm's
project-creation flow.
Create a new project
npm create @microsoft/rayfin@latest my-appThe project name is positional. Bare names with whitespace are slugified for the folder
(My App → my-app/); pass ./My App to keep spaces in the directory name.
Add Rayfin to an existing project
npm install --save-dev @microsoft/rayfin-cli
npx rayfin init [directory][directory] defaults to the current directory and doubles as the default project name.
Interactive prompts
Without flags, rayfin init asks for the template/source first. In scratch mode it then
asks which services to enable, which auth method to use, and whether static hosting should
be configured. Fabric SSO is the supported auth method. The Data dialect defaults to
mssql because managed Fabric apps use MSSQL.
The default interactive template path is the blankapp built-in, displayed as
✨ Use default template and backed by the Universal App in 1.36. Choose Start from scratch only when you want the CLI to write
a minimal rayfin.yml instead of copying a template.
Reconfiguring an existing project
Running rayfin init again in a directory with rayfin/rayfin.yml reruns configuration.
Existing entity files under rayfin/data/ are preserved. Use --overwrite only when you
intend to replace scaffold-level files that already exist.
When a template ships rayfin.yml, the initializer preserves template-authored service
settings and applies only explicit command-line choices such as --project-name,
--dialect, or --services.
Options
| Option | Default | Description |
|---|---|---|
[directory] | current directory | Directory to create the project in. |
--project-name <name> | directory name | Override the project name and update rayfin.yml without changing the directory. |
-t, --template <uri> | prompt | Template name, git URL, or local path to create the project from. |
--template-name <name> | prompt for multi-template sources | Pick one template from a multi-template source non-interactively. |
-l, --list-templates | false | List all available project templates and exit. |
--dialect <dialect> | mssql when Data is enabled | Database dialect. Fabric supports mssql. |
--services <list> | auth,data in non-interactive scratch init | Comma-separated services to enable: auth, data, functions. functions is accepted without a feature flag. Changed in 1.36 |
--auth-methods <list> | fabric | Comma-separated auth methods. fabric is the supported value. |
--static-hosting | true | Scaffold a static frontend. |
--overwrite | false | Overwrite existing configuration files. |
-w, --workspace <name> | — | Fabric workspace display name. Mutually exclusive with --workspace-id. |
--workspace-id <id> | — | Fabric workspace ID. Mutually exclusive with --workspace. |
--item-id <id> | — | Fabric App Item ID to pre-associate with the project. |
Root -y, --yes, --output <mode>, --json, and --verbose also apply.
Services
Auth and Data are regular services. Functions are regular in 1.36; use
--services auth,data,functions to scaffold the Functions block and starter package.
Storage remains experimental and is only offered when RAYFIN_FEATURE_FLAGS=storage or an
existing config enables storage.
What init writes
For a scratch 1.36 project, rayfin init writes:
rayfin/rayfin.ymlwithid,name,version, and aservicesblock.services.staticHosting.assetAccess: protectedwhen static hosting is scaffolded. New in 1.35.1services.functions.auth.type: applicationwhen Functions are selected. New in 1.36rayfin/data/when Data is enabled.- A Functions package when Functions are enabled, unless the template already supplies one.
.gitignoreentries for local Rayfin state.- Agent files:
AGENTS.mdone time,mcpServers.rayfinin.mcp.json, and Rayfin skills under.agents/skills/.
When a template already ships rayfin.yml, the CLI preserves the authored service shape
and only applies explicit identity, dialect, and --services edits.
Template selection
Built-in templates use stable CLI names such as dataapp, gettingstartedauth, and
todoapp. The blankapp built-in remains the visible default template name; in 1.36 it is backed by universal-app and displayed as ✨ Use default template. Plugin automation can still pass --template universal-app.
Changed in 1.36
Run npx rayfin init --list-templates in the target project to see names accepted by the
installed CLI. See Templates.
Next steps
npx rayfin login
npm run dev
npx rayfin upUse npm run dev for the local Fabric-backed session. Use rayfin up to publish static
content and Functions.
Agent files subcommand
rayfin init ai-files is documented on Ai-files.
Create a new Rayfin project named orders-app with the current CLI. Use
`npm create @microsoft/rayfin@latest orders-app -- --services auth,data,functions --auth-methods fabric --yes`,
then show the generated rayfin/rayfin.yml and confirm it contains
`services.staticHosting.assetAccess: protected` and `services.functions.auth.type: application`.