dify/web
yyh cfb54a0e7d fix: enhance version management and validation in workflow hooks
- Updated `useVibeFlowData` to prevent adding empty graphs and ensure the current version is correctly derived from available versions.
- Improved error handling in `applyFlowchartToWorkflow` to notify users when the current flow graph is invalid.
- Added checks to only add valid workflow graphs to the versions list, enhancing data integrity.
2025-12-29 10:42:23 +08:00
..
.husky chore: update TypeScript type-check command and add native-preview dependency for faster performance (#29179) 2025-12-05 14:42:37 +08:00
.storybook chore(web): new lint setup (#30020) 2025-12-23 16:58:55 +08:00
.vscode chore(web): new lint setup (#30020) 2025-12-23 16:58:55 +08:00
__mocks__ chore(web): migrate lodash-es to es-toolkit compat (#30126) 2025-12-25 09:44:57 +08:00
__tests__ chore: lint require and how to import react (#30041) 2025-12-23 18:02:10 +08:00
app fix: enhance version management and validation in workflow hooks 2025-12-29 10:42:23 +08:00
assets feat: introduce trigger functionality (#27644) 2025-11-12 17:59:37 +08:00
bin refactor(web): migrate to Vitest and esm (#29974) 2025-12-22 16:35:22 +08:00
config feat: allow config NEXT_PUBLIC_BATCH_CONCURRENCY (#30086) 2025-12-26 10:49:10 +08:00
context refactor(web): Migrate to Unified TanStack Devtools (#30279) 2025-12-29 09:43:44 +08:00
docker fix: Login secret text transmission (#29659) 2025-12-16 16:55:51 +08:00
hooks chore: fix type check for i18n (#30058) 2025-12-24 16:31:16 +08:00
i18n feat: update Vibe panel to use new event handling and versioning for flowcharts 2025-12-29 10:42:22 +08:00
i18n-config fix: load i18n on server (#30171) 2025-12-25 19:13:59 +08:00
models refactor(web): migrate log service to TanStack Query (#30065) 2025-12-24 15:25:28 +08:00
public fix: Downgrade @monaco-editor/loader to v1.5.0 (#27282) 2025-10-22 20:18:24 +08:00
scripts feat(refactoring): introduce comprehensive guidelines and tools for component refactoring in Dify (#30162) 2025-12-25 18:19:28 +08:00
service feat: v1 2025-12-29 10:42:21 +08:00
testing feat(refactoring): introduce comprehensive guidelines and tools for component refactoring in Dify (#30162) 2025-12-25 18:19:28 +08:00
themes fix(theme): make sticky headers opaque in dark mode (Monaco sticky sc… (#29826) 2025-12-18 15:00:15 +08:00
types feat: allow config NEXT_PUBLIC_BATCH_CONCURRENCY (#30086) 2025-12-26 10:49:10 +08:00
utils chore(web): migrate lodash-es to es-toolkit compat (#30126) 2025-12-25 09:44:57 +08:00
.dockerignore Enhance Code Consistency Across Repository with `.editorconfig` (#19023) 2025-04-29 18:04:33 +08:00
.env.example feat: allow config NEXT_PUBLIC_BATCH_CONCURRENCY (#30086) 2025-12-26 10:49:10 +08:00
.gitignore chore(web): new lint setup (#30020) 2025-12-23 16:58:55 +08:00
AGENTS.md test: add comprehensive tests for CustomizeModal component (#29709) 2025-12-16 14:21:05 +08:00
CLAUDE.md test: add comprehensive tests for CustomizeModal component (#29709) 2025-12-16 14:21:05 +08:00
Dockerfile docker: use `COPY --chown` in api Dockerfile to avoid adding layers by explicit `chown` calls (#28756) 2025-11-28 11:33:06 +08:00
README.md refactor(web): migrate to Vitest and esm (#29974) 2025-12-22 16:35:22 +08:00
eslint.config.mjs chore: enable ts/no-explicit-any, remove no-unused-vars (#30042) 2025-12-23 18:26:02 +08:00
global.d.ts refactor: update install status handling in plugin installation process (#27594) 2025-10-29 18:31:02 +08:00
knip.config.ts refactor(web): migrate to Vitest and esm (#29974) 2025-12-22 16:35:22 +08:00
middleware.ts integrate Amplitude analytics into the application (#29049) 2025-12-03 14:22:12 +08:00
next.config.js chore(web): new lint setup (#30020) 2025-12-23 16:58:55 +08:00
package.json refactor(web): Migrate to Unified TanStack Devtools (#30279) 2025-12-29 09:43:44 +08:00
pnpm-lock.yaml refactor(web): Migrate to Unified TanStack Devtools (#30279) 2025-12-29 09:43:44 +08:00
postcss.config.js refactor(web): migrate to Vitest and esm (#29974) 2025-12-22 16:35:22 +08:00
tailwind-common-config.ts refactor(web): migrate to Vitest and esm (#29974) 2025-12-22 16:35:22 +08:00
tailwind.config.js chore(web): new lint setup (#30020) 2025-12-23 16:58:55 +08:00
tsconfig.json chore(web): new lint setup (#30020) 2025-12-23 16:58:55 +08:00
typography.js refactor(web): migrate to Vitest and esm (#29974) 2025-12-22 16:35:22 +08:00
vitest.config.ts chore(web): new lint setup (#30020) 2025-12-23 16:58:55 +08:00
vitest.setup.ts chore(web): new lint setup (#30020) 2025-12-23 16:58:55 +08:00

README.md

Dify Frontend

This is a Next.js project bootstrapped with create-next-app.

Getting Started

Run by source code

Before starting the web frontend service, please make sure the following environment is ready.

First, install the dependencies:

pnpm install

Then, configure the environment variables. Create a file named .env.local in the current directory and copy the contents from .env.example. Modify the values of these environment variables according to your requirements:

cp .env.example .env.local
# For production release, change this to PRODUCTION
NEXT_PUBLIC_DEPLOY_ENV=DEVELOPMENT
# The deployment edition, SELF_HOSTED
NEXT_PUBLIC_EDITION=SELF_HOSTED
# The base URL of console application, refers to the Console base URL of WEB service if console domain is
# different from api or web app domain.
# example: http://cloud.dify.ai/console/api
NEXT_PUBLIC_API_PREFIX=http://localhost:5001/console/api
NEXT_PUBLIC_COOKIE_DOMAIN=
# The URL for Web APP, refers to the Web App base URL of WEB service if web app domain is different from
# console or api domain.
# example: http://udify.app/api
NEXT_PUBLIC_PUBLIC_API_PREFIX=http://localhost:5001/api

# SENTRY
NEXT_PUBLIC_SENTRY_DSN=

[!IMPORTANT]

  1. When the frontend and backend run on different subdomains, set NEXT_PUBLIC_COOKIE_DOMAIN=1. The frontend and backend must be under the same top-level domain in order to share authentication cookies.
  2. It's necessary to set NEXT_PUBLIC_API_PREFIX and NEXT_PUBLIC_PUBLIC_API_PREFIX to the correct backend API URL.

Finally, run the development server:

pnpm run dev

Open http://localhost:3000 with your browser to see the result.

You can start editing the file under folder app. The page auto-updates as you edit the file.

Deploy

Deploy on server

First, build the app for production:

pnpm run build

Then, start the server:

pnpm run start

If you want to customize the host and port:

pnpm run start --port=3001 --host=0.0.0.0

If you want to customize the number of instances launched by PM2, you can configure PM2_INSTANCES in docker-compose.yaml or Dockerfile.

Storybook

This project uses Storybook for UI component development.

To start the storybook server, run:

pnpm storybook

Open http://localhost:6006 with your browser to see the result.

Lint Code

If your IDE is VSCode, rename web/.vscode/settings.example.json to web/.vscode/settings.json for lint code setting.

Test

We use Vitest and React Testing Library for Unit Testing.

📖 Complete Testing Guide: See web/testing/testing.md for detailed testing specifications, best practices, and examples.

Run test:

pnpm test

Example Code

If you are not familiar with writing tests, refer to:

Analyze Component Complexity

Before writing tests, use the script to analyze component complexity:

pnpm analyze-component app/components/your-component/index.tsx

This will help you determine the testing strategy. See web/testing/testing.md for details.

Documentation

Visit https://docs.dify.ai/getting-started/readme to view the full documentation.

Community

The Dify community can be found on Discord community, where you can ask questions, voice ideas, and share your projects.