dify/web
Jingyi-Dify 646fd90716 refactor(web): split main nav components
- Move MainNav sections into focused components under main-nav/components

- Reuse Explore AppNavItem for MainNav web app rows via a mainNav variant

- Keep WorkspaceCard expanded panel behavior and styling aligned with the pre-refactor UI
2026-05-07 10:59:16 -07:00
..
__mocks__ refactor(web): portal to follow elem migration (#35892) 2026-05-07 13:02:11 +00:00
__tests__ refactor(web): portal to follow elem migration (#35892) 2026-05-07 13:02:11 +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(web): split main nav components 2026-05-07 10:59:16 -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 feat(web): refine main nav onboarding UI 2026-05-07 10:59:16 -07:00
contract refactor: verticalize tag management and batch bindings (#35840) 2026-05-07 01:36:10 +00:00
docker feat: collaboration (#30781) 2026-04-16 02:21:04 +00:00
docs refactor(web): portal to follow elem migration (#35892) 2026-05-07 13:02:11 +00:00
features/tag-management refactor(web): migrate tag controls to combobox (#35881) 2026-05-07 08:55:13 +00:00
hooks fix(web): normalize dify-ui overlay control (#35832) 2026-05-06 07:28:13 +00:00
i18n feat(web): refine main nav onboarding UI 2026-05-07 10:59:16 -07:00
i18n-config chore: workspace level typecheck (#35329) 2026-04-16 14:42:04 +00:00
models refactor: verticalize tag management and batch bindings (#35840) 2026-05-07 01:36:10 +00:00
next feat: marketplace and oauth fixes (#35509) 2026-04-24 07:53:14 +00: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 refactor: verticalize tag management and batch bindings (#35840) 2026-05-07 01:36:10 +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 refactor: verticalize tag management and batch bindings (#35840) 2026-05-07 01:36:10 +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 refactor(web): portal to follow elem migration (#35892) 2026-05-07 13:02:11 +00: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 refactor(web): portal to follow elem migration (#35892) 2026-05-07 13:02:11 +00:00
eslint.constants.mjs refactor(web): portal to follow elem migration (#35892) 2026-05-07 13:02:11 +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 chore: allow configurable Next.js dev origins (#35683) 2026-04-29 09:40:26 +00:00
package.json refactor: improve model selector search (#35875) 2026-05-07 07:05:14 +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 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 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
# 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.