Dify Self-Hosted

IntermediateAi Agents

Self-hosted Dify: workflows, RAG knowledge bases, and agents for your whole team, on your own server and without plan limits.

Published 12 October 2026 · Last updated 12 October 2026

Core Tools
Redis
Redis
Docker
Docker
NGINX
NGINX
Dify
Dify
Vector Database
Weaviate
Qdrant
PostgreSQL
Chroma
Database
PostgreSQL
MySQL
Hosting
Hetzner
Hostinger
DigitalOcean
Amazon Web Services
Google Cloud Platform

About Dify Self-Hosted

Dify is a platform for building LLM applications: a visual canvas for workflows, chatflows, and agents, a RAG pipeline that turns documents into searchable knowledge bases, and model providers shared across apps, with every app published as a web app, an embeddable widget, or an API. The Community Edition is free and self-hosted, and it is the same product as Dify Cloud without the plan limits on members, apps, knowledge documents, and storage. Running it yourself keeps prompts, documents, and the provider keys stored in Dify on infrastructure you administer. The license allows internal use and using Dify as the backend of your own products, but running it as a multi-tenant service for outside customers, or removing the Dify logo from the frontend, needs a commercial license.

The official Docker Compose file starts about fifteen containers. Dify's API, a websocket API, a Celery worker and scheduler, the web app, a plugin daemon, and an agent backend come from Dify's own images. Around them run PostgreSQL (or MySQL) for apps, users, and run history, Redis as the task broker and cache, Weaviate for the knowledge bases' vectors, two code sandboxes for code nodes, two Squid proxies that keep server-side requests away from internal addresses, and NGINX in front. Dify's floor is 2 CPU cores and 4 GB of RAM; once knowledge bases fill, an 8 GB server leaves headroom. Everything durable sits in the volumes directory next to the Compose file.

Exposure comes with the bundle. NGINX listens on port 80 and routes the console, the web apps, the API, and the plugin endpoints, so there is no separate reverse proxy to choose: enable HTTPS in the .env file and run the optional certbot profile for a Let's Encrypt certificate, remembering that it does not schedule renewals. Before the address goes public, set INIT_PASSWORD, because otherwise whoever opens the /install page first creates the admin account, and replace the fixed passwords and keys the example .env ships for the database, Redis, the vector store, the sandbox, the plugin daemon, and the agent backend. A self-hosted PaaS template is the alternative that generates those secrets and terminates TLS, and a tunnel works when nothing on the server may accept inbound traffic.

Models and tools arrive as plugins. Each workspace adds model providers from the Dify Marketplace (OpenAI, Anthropic, Gemini, a local Ollama server, or any OpenAI-compatible endpoint), and every app picks its own model, so the server needs no model to start. Uploaded files and documents stay on the local volume unless object storage is configured, and tracing to an external tool is a per-app setting in Dify's Monitoring page. All of these are optional.

Key Features

  • ✓Dify's official Docker Compose deployment: API, workers, web app, plugin daemon, and code sandboxes in one bundle
  • ✓Workflows, chatflows, and agents on a visual canvas, published as web apps, widgets, or APIs
  • ✓RAG knowledge bases on a vector store chosen at install: Weaviate by default, or Qdrant, pgvector, or Chroma
  • ✓Model providers and tools installed as plugins from the Dify Marketplace
  • ✓Bundled NGINX with an optional certbot profile for Let's Encrypt certificates
  • ✓No message-credit, app, or member limits in the Community Edition

When to Use Dify Self-Hosted

  • →An internal AI app platform where teams build chatbots and workflows without writing a backend
  • →RAG assistants over company documents that have to stay on your own servers
  • →Publishing agent workflows as APIs that other products call
  • →Moving a Dify Cloud workspace that has outgrown its plan onto your own server
  • →Comparing models from several providers, local ones included, side by side in one workspace

Pros

  • A free Community Edition with no limits on apps, members, or knowledge documents
  • One Compose command brings up the whole platform, NGINX and code sandboxes included
  • Knowledge bases, agents, and workflows in one product, so there are fewer services to stitch together
  • The database, vector store, and file storage are configuration choices, not code changes

Cons

  • About fifteen containers and a 4 GB floor, heavier than most self-hosted AI builders
  • The example configuration ships fixed passwords and keys that must be replaced before the server goes public
  • The license forbids multi-tenant hosting for outside customers and removing the Dify logo without a commercial license
  • Upgrades mean comparing new .env.example variables with your own .env, and certbot renewals are manual

Vector Database Options for Dify Self-Hosted

Weaviate

Dify Self-Hosted with Weaviate

The default vector store in Dify's Compose file, started as its own container and selected with VECTOR_STORE=weaviate, so knowledge bases work with no extra setup, including hybrid keyword and vector search. Its index lives in memory, which makes it the container that grows most as knowledge bases fill, and major Weaviate server upgrades have needed the migration steps Dify documents in its own upgrade guides.

Qdrant

Dify Self-Hosted with Qdrant

Selected with VECTOR_STORE=qdrant, either through the Compose file's qdrant profile or by pointing Dify at a Qdrant server or Qdrant Cloud with a URL and API key. The bundled profile pins an old Qdrant image, so run a current release when hosting it yourself. A fit when the team already operates Qdrant or wants its filtering and quantization controls.

PostgreSQL

Dify Self-Hosted with PostgreSQL with pgvector

Keeps vectors in PostgreSQL with the pgvector extension, selected with VECTOR_STORE=pgvector. The Compose profile starts a separate pgvector container, or the settings can point at a database whose image includes the extension, which is how a self-hosted PaaS template keeps the bundle to one database. It suits modest knowledge bases; very large collections are where a dedicated vector database earns its memory.

Chroma

Dify Self-Hosted with Chroma

The lightest of the four, selected with VECTOR_STORE=chroma; the Compose profile runs a Chroma server container. It suits a small team trying Dify's knowledge features. The profile pins Chroma 0.5.20, an older release, so check compatibility before moving the server to a newer one.

Database Options for Dify Self-Hosted

PostgreSQL

Dify Self-Hosted with PostgreSQL

The default and what the Compose file starts, as PostgreSQL 15. It holds apps, workflows, users, conversations, run logs, and the encrypted provider credentials, and the plugin daemon keeps its own database on the same server. The same engine can also serve as the vector store through pgvector, which leaves one fewer service to back up.

MySQL

Dify Self-Hosted with MySQL

Supported through DB_TYPE=mysql, which starts a MySQL 8.0 container instead; MySQL-compatible databases such as TiDB use the same setting. Pick it when the team already operates MySQL and wants Dify's data in that tooling. Choose at install: moving between the two engines later is a data migration, not a setting.

These are highlighted picks. To see all the tools, check the Databases category.

Hosting Options for Dify Self-Hosted

Hetzner

Deploy Dify Self-Hosted on Hetzner

The default. Dify's floor of 2 cores and 4 GB is a shared-vCPU server at about €19 a month, enough for a trial; for a team with knowledge bases, the 8 GB plan at about €35 leaves Weaviate and the workers room to grow. It is a plain root VPS: install Docker, check out a release, copy the example .env, replace its passwords and keys, set INIT_PASSWORD, and start the Compose file. Hourly billing makes moving up a plan a short restart.

Hostinger

Deploy Dify Self-Hosted on Hostinger

The budget entry. The KVM 2 plan has 2 vCPUs, 8 GB of RAM, and 100 GB of NVMe at $8.99 a month on a two-year term, $14.99 at the standard rate, which is the comfortable size for the full Dify bundle. Root access is full and the panel adds weekly backups, but the volumes directory still needs its own copy before each upgrade, and HTTPS through the bundled certbot profile is your job.

DigitalOcean

Deploy Dify Self-Hosted on DigitalOcean

Per-second billing and snapshots from the panel. The 4 GB Basic Droplet at $24 a month meets Dify's floor, and the 8 GB plan with 4 vCPUs at $48 gives a team headroom. A snapshot before each upgrade is the simplest rollback, since database migrations run when the API container starts. Managed PostgreSQL can take the database off the server later, though the apps and conversations then live on DigitalOcean's database service.

Amazon Web Services

Deploy Dify Self-Hosted on Amazon Web Services

The route with an actively maintained template: the aws-samples CDK project runs Dify's services on ECS Fargate with Aurora Serverless v2 PostgreSQL and ElastiCache behind a load balancer, and wires in Bedrock models and Knowledge Bases through IAM. Its own estimate for a low-cost configuration is about $50 a month before model usage. Dify Premium on the AWS Marketplace is the other AWS route, an EC2 image that adds custom branding.

Google Cloud Platform

Deploy Dify Self-Hosted on Google Cloud Platform

There is no maintained template here: a community Terraform configuration for Cloud Run, Cloud SQL, and Memorystore hasn't been updated since mid-2025, so most teams run the Compose file on a Compute Engine VM. A general-purpose machine with 2 vCPUs and 8 GB costs about $50 a month left on, and Dify's Vertex AI plugin reaches Google's models from the same project. It fits when the documents and the applications calling Dify already live in Google Cloud.

These are highlighted picks. To see all the tools, check the Hosting & Cloud category.

Dify Self-Hosted Add-ons

Each addition below extends this stack with a capability the base stack works fine without. None are required: include the ones your product actually needs when building this stack, and skip the rest.

LLM Observability Add-ons

Add LLM observability when you want to see every model call, tool call, and token cost inside a run, so a wrong answer can be traced to the step that caused it.

Langfuse

Dify Self-Hosted with Langfuse

Configured per app in Dify's Monitoring page: paste a Langfuse public key, secret key, and host, and every run of that app arrives as a trace with its nodes, model calls, latency, and token cost. The host can be Langfuse Cloud or your own server, with Langfuse Self-Hosted as a stack of its own. Dify's built-in logs show what an app answered; Langfuse adds the cost and timing view across apps.

LangSmith

Dify Self-Hosted with LangSmith

The same per-app Monitoring setting with a LangSmith API key and project, for teams already tracing other LangChain-based work there. It is a hosted, closed-source service with self-hosting on Enterprise only, so traces with prompts leave your server; the free Developer plan covers one seat and 5,000 traces a month.

Model Inference Add-ons

Add model inference when you want an open-weight model in the mix: on your own hardware for privacy, or on a hosted inference provider for speed and low per-token prices.

Ollama

Dify Self-Hosted with Ollama

Added through the official Ollama plugin from the Dify Marketplace, one of its most installed: give it the Ollama server's base URL, port 11434 by default, and the model names, and every app in the workspace can pick them. Dify runs in containers, so use the host's address rather than localhost. A local model needs far more memory than Dify's 4 GB floor, or a graphics card, so it belongs on a larger server or a separate machine.

vLLM

Dify Self-Hosted with vLLM

For open-weight models served to many users from a GPU server: add it through Dify's OpenAI-API-compatible provider plugin with the vLLM server's /v1 address and API key, and the model becomes available to every app. vLLM serves one model per server, so each model is its own entry. vLLM Inference Server is a stack of its own.

Groq

Dify Self-Hosted with Groq

A hosted provider of open-weight models on its own chips, added with the GroqCloud plugin and an API key. Its speed suits the many short model calls a workflow makes, such as classifying a question before retrieval, and billing is per token with a free rate-limited tier.

These are highlighted picks. To see all the tools, check the AI Runtime & Serving category.

Model Aggregator Add-ons

Add a model aggregator when you want one API key and one bill for models from many providers, with automatic fallback when one of them is down, instead of setting up each provider separately.

OpenRouter

Dify Self-Hosted with OpenRouter

The official OpenRouter plugin gives every app one key and one prepaid balance for hundreds of hosted models, so a workspace can try several providers without storing a key for each. Models are billed at the providers' prices, with a 5.5% fee when you buy credits.

LiteLLM

Dify Self-Hosted with LiteLLM

A gateway you host between Dify and the providers, added through the OpenAI-API-compatible plugin with the gateway's address. The gateway holds the provider keys, enforces budgets and rate limits per key, and falls back between providers, which matters when several teams share one Dify server. LiteLLM Self-Hosted is a stack of its own.

These are highlighted picks. To see all the tools, check the AI Model Aggregators category.

Tunnel Add-ons

Add a tunnel when you're self-hosting without a static IP or can't open inbound ports — a home server, a VPS behind restrictive network policies, or anywhere a reverse proxy alone can't reach the internet.

Cloudflare Tunnel

Dify Self-Hosted with Cloudflare Tunnel

A public HTTPS address through an outbound-only connection, pointed at the bundled NGINX on port 80, so the console, the web apps, and the API are reachable while no inbound port is open and no certificate has to be renewed on the server. Free, with Cloudflare Access in front if the console should sit behind your company login. A request with no answer within about 125 seconds fails with a 524 on non-Enterprise plans, so stream long workflow runs. A stable hostname needs a domain on Cloudflare.

ngrok

Dify Self-Hosted with ngrok

The quick-start tunnel for showing a Dify app from a laptop or testing a webhook: one command gives the bundled NGINX a public HTTPS address with no domain needed. The free plan includes three endpoints, 1 GB of transfer, 20,000 requests, and an interstitial page on browser visits, so it is a trial route, not the address apps rely on. Paid plans start at $10 a month.

Object Storage Add-ons

Add object storage when your app accepts file uploads or produces files, such as avatars, documents, images, and exports, and those files should live outside your database and server disk.

Amazon S3

Dify Self-Hosted with Amazon S3

Set STORAGE_TYPE to s3 with a bucket, region, and keys, and Dify keeps uploaded files, knowledge-base documents, and generated files in the bucket instead of the local volume. The server then holds less state to back up, and several API containers can share the same files. Storage is billed per GB, with request and transfer charges on top.

Cloudflare R2

Dify Self-Hosted with Cloudflare R2

The same s3 storage setting pointed at R2's S3-compatible endpoint through S3_ENDPOINT, with no egress fees when people download the files Dify serves. A fit when knowledge documents and generated files are large or downloaded often, and the server should keep as little state as possible.

These are highlighted picks. To see all the tools, check the Object Storage category.

Frequently Asked Questions about Dify Self-Hosted

Why self-host Dify instead of using Dify Cloud?

Dify Cloud is the same product with plan limits: the free Sandbox has 200 message credits, one member, and five apps, Professional is $59 a month per workspace for 3 members and 50 apps, and Team is $159 for 50 members and 200 apps. The self-hosted Community Edition has none of those caps and costs a server plus what the model providers bill, and it keeps documents, prompts, and stored provider keys on infrastructure you administer. What it costs is operating about fifteen containers, the upgrades, and the backups. The license draws the line at offering Dify to outside customers as a multi-tenant service and at removing its branding; Dify Premium on AWS covers branding, and Enterprise adds SSO and multi-workspace management by quote.

What size server does Dify need?

Dify's Docker Compose guide sets the floor at 2 CPU cores and 4 GB of RAM, which runs all fifteen containers for a trial or a small team. The figure that moves is the vector store: Weaviate keeps its index in memory, so a few large knowledge bases are what push a server from 4 GB toward 8 GB, and 8 GB is the comfortable size once a team uploads real document sets. The workers and the API scale with how many workflows run at once, not with the number of users. Disk has no official floor; it grows with uploaded files, vectors, and run logs. A local model is a separate requirement, far larger than Dify itself.

Where does state live, and what needs backing up?

The volumes directory next to the Compose file holds all of it: the PostgreSQL data with apps, conversations, and encrypted credentials, the Weaviate index, Redis, uploaded files and documents, and the installed plugins. Back it up together with the .env file, either with the stack stopped or with a pg_dump plus a copy of the other directories. Treat SECRET_KEY like a backup itself: when it is empty, Dify generates one into the storage directory, and changing or losing it logs everyone out, breaks file links, and breaks OAuth-based plugins, so set it explicitly and keep it next to the backups rather than inside them. Moving files to object storage leaves less on the server to copy.

How do upgrades and the license work?

Each release has its own upgrade notes, and the routine is the same: back up the volumes directory and the .env file, check out the new release tag, bring any new settings into your .env, and start the stack again. The dify-env-sync.sh script next to the Compose file does the middle step: it saves a timestamped copy of your .env, adds the variables that are new in .env.example without overwriting your values, and lists the ones that were removed. Optional settings live in separate templates under envs/, so compare those too if you copied any. Database migrations run when the API container starts, and Weaviate server upgrades occasionally need steps of their own, which Dify documents. The code is under a modified Apache 2.0 license: commercial and internal use are allowed, but running Dify as a multi-tenant service for outside customers, or removing the Dify logo from the frontend, needs a commercial license. SSO and multi-workspace management are Enterprise features, priced by quote.

Dify or Langflow for a self-hosted AI builder?

Both build agents and RAG pipelines on a visual canvas, but they are shaped for different builders. Dify is a complete platform: knowledge bases with their own ingestion settings, apps published as web apps and widgets, workspaces with members, and a plugin marketplace, which suits a team where non-developers build and publish apps. Langflow is lighter, one container and a database, and treats each flow as an API endpoint or MCP tool for other code to call, with custom Python components and an MIT license without Dify's conditions. Pick Dify when the output is a finished app for end users, Langflow when developers build flows that their own products call. Langflow Self-Hosted is a stack of its own.

Scores

Popularity4/5

Dify has one of the largest GitHub followings of any AI application platform, and self-hosting with the official Compose file is the common way teams run it. Templates exist on a self-hosted PaaS and AWS, though it is better known among AI builders than among developers at large.

Learning Curve3/5

One Compose command starts everything, and the console guides a first app. Running it well asks for more: about fifteen containers, an example configuration whose passwords and keys all need replacing, an install password, certbot renewals, and upgrades that compare new settings against your own.

Flexibility4/5

Two database engines, dozens of vector stores, many file-storage backends, and model providers and tools as plugins are all configuration. The bundle itself is fixed, though, and the license limits multi-tenant hosting and rebranding.

Performance3/5

Celery workers carry the workflow load and scale on their own, and the default bundle serves a team well on modest hardware. The container count sets a higher floor than lighter builders, and the in-memory vector index is where large knowledge bases cost memory.

Portability4/5

Docker Compose runs anywhere, PostgreSQL and Redis are standard, and apps export as DSL files. The modified license, the vector store's own index format, and Dify-specific plugins make a move to another platform more than a configuration change.

Tools in the Dify Self-Hosted Stack

Databases

DevOps & CI/CD

Agentic AI

Vector Database (choose one)

Database (choose one)

Hosting (choose one)

Add-ons (optional — add any, or none)

LLM Observability

Model Inference

Model Aggregator

Tunnel

Object Storage

Dify Self-Hosted Pricing

From ~$9/mo Free to start

The Community Edition is free, so the fixed cost is the server: Dify needs at least 2 CPU cores and 4 GB of RAM, and 8 GB is the comfortable size once knowledge bases fill, from about $9 a month on a long-term VPS plan. Model usage is billed by each provider through the plugins your workspace adds. For comparison, Dify Cloud's paid plans start at $59 a month per workspace.

Server (VPS or cloud)$9–50/mo

Dify needs at least 2 CPU cores and 4 GB of RAM, and 8 GB leaves room for the vector store as knowledge bases grow: $8.99 a month for 8 GB at Hostinger on a two-year term, about €19 for 4 GB or €35 for 8 GB at Hetzner, $24 to $48 at DigitalOcean, and about $50 for the AWS sample's low-cost configuration.

Dify Community EditionFree

Every feature of the open-source edition, with no limits on apps, members, or knowledge documents. Multi-tenant hosting for outside customers and removing the Dify branding need a commercial license; Enterprise is priced by quote.

Model providersPay per token

Each provider plugin uses your own key and bills at that provider's prices. A local model through Ollama costs only the hardware it runs on.

ExposureFree

The bundled NGINX, Let's Encrypt certificates through the certbot profile, and the tunnels' free tiers cost nothing.

Dify Self-Hosted System Requirements

source
CPU
2 cores minimum
RAM
4 GB minimum
Disk
No official floor; uploaded files, vectors, and run logs grow with use
OS
Linux with Docker 19.03 or later, or macOS or Windows with Docker Desktop; Docker Compose 2.24.0 or later

Quoted from Dify's Docker Compose guide: CPU of 2 cores or more and RAM of 4 GiB or more, Docker Compose 2.24.0 or later. The guide counts seven core services and eight dependent components in the default deployment. The 8 GB server named in the stack's copy is an estimate for a team whose knowledge bases fill the in-memory vector index, not a vendor figure.