dify/web
Jingyi-Dify d076fc35b7 refactor: polish integrations and main nav UI
Reuse shared base controls in MainNav and Integrations, add active integration icons, and keep compact integration content framing covered by targeted tests.
2026-05-12 16:04:18 -07:00
..
__mocks__ refactor(web): portal to follow elem migration (#35892) 2026-05-07 13:02:11 +00:00
__tests__ fix: redirect unauthorized dataset access to /datasets for knowledge editors (#36073) 2026-05-12 09:38:49 +00:00
.storybook refactor: verticalize tag management and batch bindings (#35840) 2026-05-07 01:36:10 +00:00
.vscode chore: workspace lint (#35331) 2026-04-16 16:47:53 +00:00
app refactor: polish integrations and main nav UI 2026-05-12 16:04:18 -07: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: collaboration (#30781) 2026-04-16 02:21:04 +00:00
constants fix: check and update doc links (#30849) 2026-01-21 16:31:48 +08:00
context fix(web): preserve settings fallbacks during main nav update 2026-05-12 14:51:01 -07:00
contract chore(web): refresh agent skills (#36015) 2026-05-11 03:52:47 +00:00
docker feat: collaboration (#30781) 2026-04-16 02:21:04 +00:00
docs feat(web): improve a11y and remove data-testid (#35999) 2026-05-11 03:53:03 +00:00
features/tag-management fix(web): align tag filter dropdown icon (#36041) 2026-05-11 08:42:09 +00:00
hooks fix(web): normalize dify-ui overlay control (#35832) 2026-05-06 07:28:13 +00:00
i18n fix: localize integrations i18n copy 2026-05-12 14:52:40 -07:00
i18n-config chore: workspace level typecheck (#35329) 2026-04-16 14:42:04 +00:00
models refactor(web): drop headless-ui, migrate overlay to dify-ui (#35963) 2026-05-09 10:33:25 +00:00
next feat: add canonical integrations routes 2026-05-12 14:51:55 -07:00
plugins feat(dev-proxy): init package (#35852) 2026-05-07 03:32:14 +00:00
public chore: fix oxlint warnings (unused variables and imports) (#35249) 2026-04-20 13:43:17 +00:00
scripts feat(dev-proxy): init package (#35852) 2026-05-07 03:32:14 +00:00
service fix: redirect unauthorized dataset access to /datasets for knowledge editors (#36073) 2026-05-12 09:38:49 +00:00
test chore: knip fix (#34481) 2026-04-02 15:03:42 +00:00
themes chore(tailwind-css): migrate to css first (#35754) 2026-05-06 04:28:11 +00:00
types feat(dify-ui): add drawer (#35917) 2026-05-08 08:53:32 +00:00
utils chore: enable noUncheckedIndexedAccess (#35178) 2026-04-16 13:01:35 +00:00
.env.example feat(dev-proxy): init package (#35852) 2026-05-07 03:32:14 +00:00
.gitignore chore: workspace lint (#35331) 2026-04-16 16:47:53 +00:00
AGENTS.md feat: add integrations tools page with prebuilt icons 2026-05-12 14:51:01 -07:00
CLAUDE.md test: add comprehensive tests for CustomizeModal component (#29709) 2025-12-16 14:21:05 +08:00
dev-proxy.config.ts feat(dev-proxy): init package (#35852) 2026-05-07 03:32:14 +00:00
Dockerfile fix(web): disable pnpm dependency checks during Docker build (#35686) 2026-04-29 07:56:36 +00:00
Dockerfile.dockerignore build: include packages in docker build (#34532) 2026-04-03 13:40:16 +00:00
env.ts feat: collaboration (#30781) 2026-04-16 02:21:04 +00:00
eslint.config.mjs chore(web): remove drawer overlay import restriction (#35990) 2026-05-10 09:35:27 +00:00
eslint.constants.mjs chore(web): remove drawer overlay import restriction (#35990) 2026-05-10 09:35:27 +00:00
global.d.ts feat: integrate Google Analytics event tracking and update CSP for script sources (#30365) 2025-12-30 18:06:47 +08:00
instrumentation-client.ts chore: workspace level typecheck (#35329) 2026-04-16 14:42:04 +00:00
knip.config.ts feat(dev-proxy): init package (#35852) 2026-05-07 03:32:14 +00:00
next.config.ts feat: explore page to home page 2026-05-12 14:51:55 -07:00
package.json feat: finish slide 2026-05-12 14:51:54 -07:00
postcss.config.js refactor: update to tailwind v4 (#34415) 2026-04-02 07:06:11 +00:00
proxy.ts fix(web): forward csp nonce to theme script (#35960) 2026-05-09 04:35:29 +00:00
README.md feat(dev-proxy): init package (#35852) 2026-05-07 03:32:14 +00:00
tsconfig.json chore: generate enterprise console API (#35735) 2026-04-30 09:15:08 +00:00
tsslint.config.ts fix: enforce no-leaked-conditional-rendering as error and fix violations (#31262) 2026-01-20 23:08:59 +08:00
vite.config.ts refactor(web): portal to follow elem migration (#35892) 2026-05-07 13:02:11 +00:00
vitest.setup.ts refactor(web): drop headless-ui, migrate overlay to dify-ui (#35963) 2026-05-09 10:33:25 +00:00

Dify Frontend

This is a Next.js project, but you can dev with vinext.

Getting Started

Run by source code

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

You can also use Vite+ with the corresponding vp commands. For example, use vp install instead of pnpm install and vp test instead of pnpm run test.

Tip

It is recommended to install and enable Corepack to manage package manager versions automatically:

npm install -g corepack
corepack enable

Learn more: Corepack

Run the following commands from the repository root.

First, install the dependencies:

pnpm install

Note

JavaScript dependencies are managed by the workspace files at the repository root: package.json, pnpm-lock.yaml, pnpm-workspace.yaml, and .nvmrc. Install dependencies from the repository root, then run frontend scripts from web/.

Then, configure the environment variables. Create web/.env.local and copy the contents from web/.env.example. Modify the values of these environment variables according to your requirements:

cp web/.env.example web/.env.local

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 -C web run dev
# or if you are using vinext which provides a better development experience
pnpm -C web run dev:vinext
# (optional) start the dev proxy server so that you can use online API in development
# edit web/dev-proxy.config.ts to choose proxy paths
# edit web/.env.local to override DEV_PROXY_TARGET, DEV_PROXY_ENTERPRISE_TARGET, DEV_PROXY_HOST, or DEV_PROXY_PORT
pnpm -C web run dev:proxy

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

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

Deploy

Deploy on server

First, build the app for production:

pnpm -C web run build

Then, start the server:

pnpm -C web run start

If you build the Docker image manually, use the repository root as the build context:

docker build -f web/Dockerfile -t dify-web .

If you want to customize the host and port:

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

Storybook

This project uses Storybook for UI component development.

To start the storybook server, run:

pnpm -C web storybook

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

Lint Code

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

Then follow the Lint Documentation to lint the code.

Test

We use Vitest and React Testing Library for Unit Testing.

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

Important

As we are using Vite+, the vitest command is not available. Please make sure to run tests with vp commands. For example, use npx vp test instead of npx vitest.

Run test:

pnpm -C web test

Note

Our test is not fully stable yet, and we are actively working on improving it. If you encounter test failures only in CI but not locally, please feel free to ignore them and report the issue to us. You can try to re-run the test in CI, and it may pass successfully.

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 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.