migrate-app-to-flows
cognitedata/builder-skills
Orchestrate full migration of legacy Dune apps to Flows app hosting infrastructure.
What is migrate-app-to-flows?
Migrates a legacy Dune app to the new Flows app hosting (appsApi) by auditing current state, updating app.json, setting up auth, creating manifest.json with network permissions, and updating deploy scripts. Use this when a user wants to move their existing app to Flows infrastructure.
- Audits current app.json, package.json, vite.config.ts, and manifest.json to identify migration gaps
- Updates app.json to add infra field set to appsApi and converts legacy deployment key format to deployments array
- Delegates auth setup to setup-flows-auth skill for DuneAuthProvider replacement and Vite plugin updates
- Creates or updates manifest.json with Content Security Policy network permissions by scanning for external API calls
- Updates deploy scripts in package.json to use @cognite/cli instead of dune or @cognite/dune commands
- Performs final check for remaining legacy Dune references and reports next steps
How to install migrate-app-to-flows
npx skills add https://github.com/cognitedata/builder-skills --skill migrate-app-to-flows- Existing legacy Dune app with app.json and package.json
- Node.js and npm installed
- Access to the app source code repository
How to use migrate-app-to-flows
- 1.Run the skill to audit your current app.json, package.json, vite.config.ts, and manifest.json
- 2.Review the audit report showing which migration steps are needed
- 3.Allow the skill to update app.json with infra: appsApi and fix deployment key format if needed
- 4.The skill will delegate to setup-flows-auth for authentication wiring
- 5.Review and approve the generated or updated manifest.json with network permissions
- 6.Verify deploy scripts in package.json are updated to @cognite/cli
- 7.Run npm run dev to test the migrated app locally
- 8.Deploy using: npx @cognite/cli@latest apps deploy --interactive
Use cases
- Migrating a POC or legacy app from Dune to the new Flows hosting platform
- Converting an app that uses DuneAuthProvider to the new Flows auth model
- Setting up proper Content Security Policy permissions for external API integrations
- Updating deployment infrastructure from old dune CLI to @cognite/cli
- Consolidating multiple migration steps into a single orchestrated workflow
- App developers migrating legacy Dune applications
- Teams moving apps to Flows infrastructure
- DevOps engineers updating deployment pipelines
- Cognite Fusion app maintainers
migrate-app-to-flows FAQ
The skill will skip the app.json update step and proceed with the remaining migration steps.
No, the setup-flows-auth skill handles all auth-related changes including package installation, Vite plugin updates, and connectToHostApp wiring.
It scans the src/ directory for fetch, axios, and XMLHttpRequest calls to identify external domains, then creates appropriate network permission entries. You should review and verify any dynamic URLs.
The skill will create manifest.json with an empty network array, which is valid for apps that only call CDF (automatically allowed).
No, dune deploy and @cognite/dune commands must be replaced with @cognite/cli@latest apps deploy. All other scripts like start, build, and test remain unchanged.
Full instructions (SKILL.md)
Source of truth, from cognitedata/builder-skills.
name: migrate-app-to-flows description: "MUST be used when migrating a legacy Dune app to the new Flows app hosting infrastructure. Orchestrates the full migration: audits current state, updates app.json to appsApi infra, delegates auth wiring to setup-flows-auth, creates or updates manifest.json network permissions, and updates deploy scripts to @cognite/cli. Use this whenever a user says 'migrate to Flows', 'migrate to new infra', 'move from dune to flows', 'migrate legacy app', or wants to move their existing app to the new Flows app hosting." allowed-tools: Read, Glob, Grep, Edit, Write, Bash metadata: argument-hint: ""
Migrate App to Flows Infrastructure
Orchestrates the full migration of a legacy Dune app to the new Flows app hosting (appsApi). Works through each area in order, skipping any already in the correct state.
Step 1 — Audit current state
Read app.json, package.json, vite.config.ts, and manifest.json (if present).
Report a concise summary before making any changes:
Migration audit:
✗ app.json: missing infra field → will add "infra": "appsApi"
✗ Auth: DuneAuthProvider in use → will run setup-flows-auth
✗ manifest.json: missing → will create
✓ Deploy script: already uses @cognite/cli
Then proceed through Steps 2–5.
Step 2 — Update app.json
If infra is already "appsApi", skip this step. Otherwise:
Fix legacy deployment key format first. Many POC apps use "deployment" (singular, plain object). The CLI requires "deployments" (plural, array). If the file has the old format, rename the key and wrap the value in an array before proceeding:
// Before (legacy)
{
"deployment": { "org": "...", "project": "...", ... }
}
// After (correct)
{
"deployments": [{ "org": "...", "project": "...", ... }]
}
Then add "infra": "appsApi":
{
"name": "My App",
"externalId": "my-app",
"versionTag": "0.0.1",
"infra": "appsApi",
"deployments": [...]
}
Step 3 — Set up Flows auth
Run the setup-flows-auth skill now. It handles everything auth-related: package installation, Vite plugin updates, entry file changes, and wiring up connectToHostApp.
Step 4 — Create or update manifest.json
The Flows host uses manifest.json to enforce a Content Security Policy for the app. It must exist at the repo root.
Create if missing:
{
"manifestVersion": 1,
"permissions": {
"network": []
}
}
Populate network permissions by scanning for outbound calls to external domains:
grep -rn "fetch\|axios\|new XMLHttpRequest" src/ --include="*.ts" --include="*.tsx"
For each group of external URLs found, add an entry to the network array using the sources/directives shape:
{
"manifestVersion": 1,
"permissions": {
"network": [
{
"sources": ["https://api.example.com", "https://maps.googleapis.com"],
"directives": ["connect-src"]
}
]
}
}
Rules:
- Use full origin (scheme + hostname) in
sources, not just the hostname. "connect-src"coversfetch/XMLHttpRequest. Use"img-src"for image URLs,"font-src"for fonts.- The CDF cluster URL is allowed automatically; do not list it.
- If no external calls exist, leave
"network": []. - Flag any dynamic URLs the user needs to verify manually.
Step 5 — Update deploy scripts
Replace any dune deploy or npx @cognite/dune commands in package.json:
{
"scripts": {
"deploy": "npx @cognite/cli@latest apps deploy --interactive",
"deploy-preview": "npx @cognite/cli@latest apps deploy --interactive"
}
}
Keep all other scripts (start, build, test, etc.) unchanged.
Step 6 — Final check
grep -rn "DuneAuthProvider\|useDune\|@cognite/dune" src/ vite.config.ts 2>/dev/null
List any remaining hits for the user to resolve. Then report:
Migration complete:
✓ app.json: infra set to "appsApi", deployments key is an array
✓ Auth: setup-flows-auth applied
✓ manifest.json: network permissions set
✓ Deploy scripts: updated to @cognite/cli
Then tell the user exactly what to do next:
Next steps:
1. Run `npm run dev` to start the dev server
2. Open Fusion and verify the app loads and CDF data appears correctly
3. When happy, deploy with: npx @cognite/cli@latest apps deploy --interactive
Related skills
More from cognitedata/builder-skills and the wider catalog.

performance
Find and fix performance issues in Flows apps—re-renders, inefficient queries, pagination, and memory leaks.

pull-changes-resolve-conflicts
Safely integrate branch changes by analyzing conflicts before resolving, preserving intentional work.

reveal-3d
Embed interactive Cognite Reveal 3D CAD viewer in Flows apps with local bundled source.

security
Find and fix security issues in Flows apps before shipping—handles credentials, input validation, XSS, injection, and auth gaps.

setup-flows-auth
Wire a React app for Flows authentication to connect to CDF inside Fusion.

setup-python-tools
Add client-side Python tool execution via Pyodide to Flows apps with automatic hook setup and chat integration.