dify/web
2026-04-30 09:15:08 +00:00
..
__mocks__ refactor(web): continue replacing PortalToFollowElem with Popover components (#35431) 2026-04-21 02:44:52 +00:00
__tests__ fix: restore app nav create submenu interaction (#35681) 2026-04-29 07:03:28 +00:00
.storybook refactor(dify-ui): finish primitive migration from web/base/ui to @langgenius/dify-ui (#35349) 2026-04-17 08:46:11 +00:00
.vscode chore: workspace lint (#35331) 2026-04-16 16:47:53 +00:00
app fix: var reference picker can not choose sub vars (#35732) 2026-04-30 08:33:29 +00: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 chore: update dependency catalog (#35594) 2026-04-27 07:29:42 +00:00
contract chore: generate enterprise console API (#35735) 2026-04-30 09:15:08 +00:00
docker feat: collaboration (#30781) 2026-04-16 02:21:04 +00:00
docs refactor(web/select): base selects to dify-ui (#35720) 2026-04-30 06:15:08 +00:00
hooks fix(web): restore "Copied" feedback state on copy buttons (#35513) 2026-04-23 06:40:52 +00:00
i18n chore: correction of ru translation (#35645) 2026-04-29 09:59:17 +08:00
i18n-config chore: workspace level typecheck (#35329) 2026-04-16 14:42:04 +00:00
models chore: update dependency catalog (#35594) 2026-04-27 07:29:42 +00:00
next feat: marketplace and oauth fixes (#35509) 2026-04-24 07:53:14 +00:00
plugins chore: generate enterprise console API (#35735) 2026-04-30 09:15:08 +00:00
public chore: fix oxlint warnings (unused variables and imports) (#35249) 2026-04-20 13:43:17 +00:00
scripts chore: update dependency catalog (#35594) 2026-04-27 07:29:42 +00:00
service chore: update dependency catalog (#35594) 2026-04-27 07:29:42 +00:00
test chore: knip fix (#34481) 2026-04-02 15:03:42 +00:00
themes feat(ui): scaffold @langgenius/dify-ui and migrate design tokens (#35256) 2026-04-15 13:11:20 +00:00
types chore: update dependency catalog (#35594) 2026-04-27 07:29:42 +00:00
utils chore: enable noUncheckedIndexedAccess (#35178) 2026-04-16 13:01:35 +00:00
.env.example feat: collaboration (#30781) 2026-04-16 02:21:04 +00:00
.gitignore chore: workspace lint (#35331) 2026-04-16 16:47:53 +00:00
AGENTS.md docs(frontend): align docs and comments (#35364) 2026-04-20 07:54:49 +00:00
CLAUDE.md test: add comprehensive tests for CustomizeModal component (#29709) 2025-12-16 14:21:05 +08: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(deps): bump base ui to 1.4.1 (#35459) 2026-04-21 08:18:31 +00:00
eslint.constants.mjs refactor(web/select): base selects to dify-ui (#35720) 2026-04-30 06:15:08 +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 chore: generate enterprise console API (#35735) 2026-04-30 09:15:08 +00:00
next.config.ts chore: allow configurable Next.js dev origins (#35683) 2026-04-29 09:40:26 +00:00
openapi-ts.enterprise.config.ts chore: generate enterprise console API (#35735) 2026-04-30 09:15:08 +00:00
package.json chore: generate enterprise console API (#35735) 2026-04-30 09:15:08 +00:00
postcss.config.js refactor: update to tailwind v4 (#34415) 2026-04-02 07:06:11 +00:00
proxy.ts feat: collaboration (#30781) 2026-04-16 02:21:04 +00:00
README.md docs(frontend): align docs and comments (#35364) 2026-04-20 07:54:49 +00:00
tailwind-common-config.ts feat(ui): scaffold @langgenius/dify-ui and migrate design tokens (#35256) 2026-04-15 13:11:20 +00:00
tailwind.config.ts refactor(dify-ui): finish primitive migration from web/base/ui to @langgenius/dify-ui (#35349) 2026-04-17 08:46:11 +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
typography.js refactor: update to tailwind v4 (#34415) 2026-04-02 07:06:11 +00:00
vite.config.ts chore: generate enterprise console API (#35735) 2026-04-30 09:15:08 +00:00
vitest.setup.ts chore: Add global fetch mock in vitest.setup.ts to suppress happy-dom ECONNREFUSED errors (#35131) 2026-04-14 03:47:01 +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
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.