Deploy to Fabric
Enable Fabric apps in your tenant, create one in the Fabric portal, and deploy your project with rayfin login and rayfin up.
Deploying to Fabric provisions your project as a managed Fabric app — Fabric hosts the database, the API, authentication, and your built frontend. This page covers the first deployment end to end.
Prerequisites
- A Rayfin project with a
rayfin/rayfin.ymlconfiguration file. - A Microsoft account with access to a Fabric workspace where you have contributor or admin permissions, and Fabric capacity assigned to that workspace.
- Fabric apps enabled in your tenant's admin settings (next section).
Enable Fabric apps in your tenant
A Fabric tenant administrator must turn this on before anyone can create a Fabric app. If you are not a tenant admin, send this section to whoever is.
- Sign in to the Fabric admin portal.
- Navigate to Tenant settings.
- Under Fabric Apps (preview), toggle the setting to Enabled.
- Choose whether to enable it for the whole organization or specific security groups.
- Click Apply.
Changes can take a few minutes to propagate.
Create a Fabric app
You can create the Fabric item first and connect your code to it, or deploy from the CLI and let it create the item for you.
From the Fabric portal: sign in to Microsoft Fabric, select or create a workspace, click New item, search for App (preview), name it, and click Create. Then click Open in VS Code on the new item to load the project locally.
From the CLI: run rayfin login followed by rayfin up in an existing project (see
below) — the first deploy creates the Fabric item in your workspace automatically, and
every subsequent deploy reuses it.
Sign in
npx rayfin loginThis opens a browser window for interactive Entra ID sign-in. Tokens are stored securely
in the OS keychain under ~/.rayfin/. Check your status at any time:
npx rayfin login statusThe MSAL account picker is always shown on sign-in, so if you have several accounts you can
choose between them by running npx rayfin login again.
For non-interactive environments (CI pipelines), authenticate as a service principal instead:
npx rayfin login --service-principal \
--client-id <app-registration-client-id> \
--client-secret <secret> \
--tenant <tenant-id>Deploy with rayfin up
npx rayfin upIf you are not signed in, this launches an interactive login automatically. rayfin up is
the canonical, all-in-one deploy command — it performs these steps in order:
- Creates a Rayfin item in your Fabric workspace (or reuses the existing one on later deploys).
- Retrieves the publishable key from the remote service.
- Syncs runtime settings from
rayfin.ymlto the remote service — auth configuration and enabled services. - Applies the database schema generated from your entity decorators.
- Builds and deploys static content, if
staticHostingis enabled — runs your build command, packages the output, and uploads it. - Persists deployment details to
rayfin/.deployments.jsonand merges the resultingRAYFIN_PUBLIC_*values intorayfin/.env.
When it finishes, the CLI prints the hosting URL, a Fabric portal link, and the deployment ID.
Preview what a deploy would do without changing anything:
npx rayfin up -nDuring local development, skip the static build/deploy phase so a local Vite server keeps serving your frontend while the backend still deploys:
npx rayfin up --exclude-services staticHostingVerify the deployment
npx rayfin up statusAdd --json for machine-readable output.
Warning
After adding or changing an entity, confirm the schema actually applied — a deploy can
report success while a newly added entity is not yet readable. Check npx rayfin up status, or query the entity directly, before assuming the change is live. See
Schema migrations for how migrations are generated and applied.
Applying schema changes after the first deploy
For any later change to your entities — a new field, a new entity, a new permission — redeploy with the same command:
npx rayfin uprayfin up applies pending schema migrations as part of its normal run, so it is the right
command for "deploy this change" even when the change is schema-only. Reach for the
narrower subcommand only when you explicitly want to push a schema change without
rebuilding or redeploying static content:
npx rayfin up db apply [--force]If the change could cause data loss (dropping a column, changing a type), the CLI blocks it
until you add --force.
Authentication
Fabric SSO (Entra ID) is the only supported authentication method — make sure it's enabled before you deploy:
services:
auth:
enabled: true
fabric:
enabled: trueRedeploy static content only
When you have only changed frontend code, skip the rest of the deploy for a faster cycle:
npx rayfin up staticapp deployAdd --skip-build to deploy existing build output without rebuilding it.
Sign out
npx rayfin logoutTroubleshooting
- 401 or 403 during deploy — your session expired. Run
npx rayfin loginagain, then retrynpx rayfin up. - Deploy fails with "Dialect is required" —
services.data.enabled: trueneeds an explicitdialect: mssql(Fabric supports MSSQL only). - Database apply reports destructive changes — review the listed operations, then add
--forceonly once you accept the data loss. - Static deploy exceeds the size limit — the compressed archive must stay under 100 MB; exclude source maps and large dev assets, or move binary files to Rayfin storage.
- GraphQL "Internal server error" after a successful deploy — look for
@text()fields with nomax; they generateNVARCHAR(MAX)on MSSQL, which can break GraphQL schema generation. Add@text({ max: N })and redeploy withnpx rayfin up db apply --force.
See Deploy troubleshooting for more.
Deploy my Rayfin app to Microsoft Fabric. Run the workflow yourself rather than printing
steps for me to run:
1. `npx rayfin login` (interactive sign-in if I am not already authenticated).
2. `npx rayfin up` to deploy the app and apply pending schema migrations.
3. `npx rayfin up status` to confirm the deployment is healthy.
If I have added or changed an entity in this session, confirm after deploying that the
change actually applied — a deploy can report success while a newly added entity is not
yet readable. If it did not apply, run `npx rayfin up db apply` and tell me what happened.
Do not pass `--force` to any command without first showing me what it would change.Next
- Fabric apps — the Fabric item model in depth.
- Schema migrations — how migrations are generated and applied.
- Auth — configure Fabric SSO.
Project structure
The rayfin/ folder layout — rayfin.yml, entities under rayfin/data/, schema.ts, generated files, and how the frontend picks up backend config.
Data
Model entities once as decorated TypeScript classes and get a database schema, GraphQL API, type-safe client, permissions, and validation from the same source.