🚀 Manage Dify apps as code — Harness AI coding assistants to build, optimize, and version control your workflows.
Building AI apps with Dify is amazing, but managing them in a browser has limitations:
| Pain Point | With Dify as Code |
|---|---|
| 😫 Editing in a tiny web textarea | ✨ Full IDE power with VS Code / Cursor |
| 🔄 No version history | 📚 Git tracks every change with full history |
| 🤖 Can't use AI to build workflows | 🚀 Let AI assistants create & optimize entire workflows |
| 👥 Hard to collaborate | 🤝 Standard Git workflows: branch, PR, merge |
| 💾 No backup | 🔒 Local files = your backup |
| 🏢 Managing multiple instances | 🌐 One place for all platforms & accounts |
Dify as Code brings the "Infrastructure as Code" philosophy to Dify — your app configurations become versionable, reviewable, and collaborative text files.
🚧 This project is actively developing. Check my Milestones for upcoming features!
Pull app configurations (DSL) from Dify to local files, edit with your favorite tools, then push changes back. Your local app.yml is the single source of truth.
Not just apps — sync your entire Dify workspace:
- Studio Apps — Workflows, Chatflows, Agents, Chat Assistants
- Models — All configured LLM, Embedding, Rerank, TTS, STT models
- Knowledge Bases — 🚧 Coming soon
- Tools — Built-in and custom tool configurations
- Plugins — Installed plugin details
Manage Dify Cloud, self-hosted instances, and multiple accounts — all from one sidebar. Switch between environments effortlessly.
Visual indicators show what's changed:
- ✅ Synced — Local matches cloud
- ⬆️ Local Modified — You have unpushed changes
- ⬇️ Remote Updated — Cloud has newer version
Credentials stored in .secrets.yml are automatically added to .gitignore. Your passwords never get committed.
Dify's DSL is just YAML — and AI understands it perfectly. With AI coding assistants (Cursor, GitHub Copilot, etc.), you can:
- Create entire workflows from scratch — Describe what you want, AI generates the DSL
- Optimize existing apps — AI analyzes and improves your prompts and logic
- Add new nodes & connections — Let AI handle the complex YAML structure
- Debug issues — AI can spot problems in your workflow configuration
- Translate & localize — Convert prompts to other languages instantly
Search "Dify as Code" in VS Code / Cursor Extensions, or install from VSIX.
Click the Dify as Code icon in the Activity Bar → [+] → Choose platform type → Enter credentials.
Apps are automatically pulled after login. Each app becomes a folder with app.yml inside.
Modify app.yml with full IDE support → Right-click → Push to Dify → Changes sync to draft.
┌─────────────┐ Pull ┌─────────────┐ Edit ┌─────────────┐
│ Dify │ ───────────▶ │ Local │ ───────────▶ │ VS Code │
│ Cloud │ │ app.yml │ │ / Cursor │
└─────────────┘ └─────────────┘ └─────────────┘
▲ │ │
│ │ Git Commit │
│ Push │◀──────────────────────────────┘
└─────────────────────────────┘
Recommended Git Workflow:
git pull— Get latest from team- Pull from Dify — Sync cloud changes
- Edit locally — Use AI assistance
git commit— Save your changes- Push to Dify — Deploy to draft
- Test & Publish in Dify UI
| Command | Description |
|---|---|
| Add Platform | Connect to Dify Cloud or self-hosted instance |
| Add Account | Add login credentials under a platform |
| Pull Updates | Download latest app configurations |
| Push to Dify | Upload local changes to cloud draft |
| New App | Create a new Workflow or Chatflow app |
| Copy as New App | Duplicate an app with new name |
| Open in Dify | Jump to Dify editor in browser |
| View Sync Status | Check sync state and timestamps |
your-workspace/
├── MyCompanyDify/ # Platform
│ ├── .platform.yml # Platform config
│ └── dev@company.com/ # Account
│ ├── .account.yml # Account config
│ ├── .secrets.yml # Credentials (gitignored)
│ └── My Workspace/ # Workspace
│ ├── .workspace.yml # Workspace config
│ ├── studio/ # Apps (Studio)
│ │ ├── CustomerServiceBot/
│ │ │ ├── app.yml # ← Edit this file!
│ │ │ └── .sync.yml # Sync metadata
│ │ └── SalesWorkflow/
│ │ └── ...
│ ├── models/ # Model configurations
│ │ └── models.yml # All LLM/Embedding/Rerank models
│ ├── knowledge/ # Knowledge bases (coming soon)
│ ├── tools/ # Tool configurations
│ │ └── tools.yml # Built-in and custom tools
│ └── plugins/ # Plugin configurations
│ └── plugins.yml # Installed plugins
└── DifyCloud/
└── ...
Just describe what you want in natural language:
"Create a customer service workflow that:
1. Classifies user intent (complaint/inquiry/feedback)
2. Routes to different LLM prompts based on intent
3. Generates a response and logs to database"
AI generates the complete app.yml — nodes, connections, prompts, everything.
"Analyze this workflow and suggest improvements for better accuracy and lower latency"
AI reviews your DSL and provides actionable suggestions.
- Commit after each logical change
- Use meaningful commit messages:
"feat: add order tracking to chatbot" - Create branches for experimental prompt changes
- Share platform configs (without
.secrets.yml) - Review prompt changes in Pull Requests
- Use Git blame to see who changed what
- VS Code 1.85.0+ or Cursor
- Node.js 18+ (for development)
- A Dify account (Cloud or self-hosted)
MIT License — Use freely, contribute back!
Issues and Pull Requests are welcome on GitHub.
Build AI apps with AI — Let your coding assistant write your Dify workflows.