dify/web
Coding On Star 7e1dc3c122
refactor(web): split share text-generation and add high-coverage tests (#33408)
Co-authored-by: CodingOnStar <hanxujiang@dify.com>
Co-authored-by: autofix-ci[bot] <114827586+autofix-ci[bot]@users.noreply.github.com>
2026-03-13 19:10:24 +08:00
..
.husky chore: skip pre commit check for merge (#33287) 2026-03-11 18:08:14 +08:00
.storybook
.vscode
__mocks__
__tests__ refactor(web): split share text-generation and add high-coverage tests (#33408) 2026-03-13 19:10:24 +08:00
app refactor(web): split share text-generation and add high-coverage tests (#33408) 2026-03-13 19:10:24 +08:00
assets
bin
config chore: add support email env (#33075) 2026-03-06 14:29:29 +08:00
constants
context refactor: spilt context for better hmr (#33033) 2026-03-05 15:54:56 +08:00
contract feat: support in site message (#33255) 2026-03-11 18:32:14 +08:00
docker chore(web): remove PM2 process manager (#30252) 2026-03-01 19:31:45 +08:00
docs chore(ui): raise overlay primitives z-index for legacy coexistence (#33185) 2026-03-10 13:46:38 +08:00
hooks refactor: spilt context for better hmr (#33033) 2026-03-05 15:54:56 +08:00
i18n fix(i18n): correct French translation of "disabled" from medical term to UI-appropriate term (#33067) 2026-03-06 09:57:43 +08:00
i18n-config chore(web): disable i18next support notice (#33309) 2026-03-12 18:18:10 +08:00
models
plugins chore: add dev proxy server, update deps (#33371) 2026-03-13 12:52:19 +08:00
public feat: support in site message (#33255) 2026-03-11 18:32:14 +08:00
scripts test: enforce app/components coverage gates in web tests (#33395) 2026-03-13 16:31:05 +08:00
service chore: update ky to 1.14.3 (#33201) 2026-03-10 18:42:30 +08:00
test refactor(web): migrate document list query state to nuqs (#32339) 2026-03-03 18:29:23 +08:00
themes
types fix: remove explore context and migrate query to orpc contract (#32320) 2026-02-14 16:18:26 +08:00
utils fix: copy to clipboard failed in non-secure (HTTP) contexts (#32287) 2026-03-10 15:46:17 +08:00
.dockerignore
.env.example chore: add dev proxy server, update deps (#33371) 2026-03-13 12:52:19 +08:00
.gitignore
.npmrc
.nvmrc fix: downgrade node version to 22 (#32897) 2026-03-03 16:00:56 +08:00
AGENTS.md feat(web): add context menu primitive and dropdown link item (#33125) 2026-03-09 12:05:38 +08:00
CLAUDE.md
Dockerfile chore: update script for build docker (#33261) 2026-03-11 11:42:19 +08:00
README.md chore(web): remove PM2 process manager (#30252) 2026-03-01 19:31:45 +08:00
env.ts chore: add support email env (#33075) 2026-03-06 14:29:29 +08:00
eslint-suppressions.json refactor(web): split share text-generation and add high-coverage tests (#33408) 2026-03-13 19:10:24 +08:00
eslint.config.mjs refactor(avatar): migrate to Base UI primitives with Record size variants (#33268) 2026-03-11 14:26:04 +08:00
eslint.constants.mjs feat(web): overlay migration guardrails + Base UI primitives (#32824) 2026-03-03 16:56:13 +08:00
global.d.ts
knip.config.ts chore: use vite plus (#33407) 2026-03-13 18:18:44 +08:00
next.config.ts chore: bring back code-inspector-plugin and agentation (#33088) 2026-03-06 17:01:18 +08:00
package.json chore: use vite plus (#33407) 2026-03-13 18:18:44 +08:00
pnpm-lock.yaml chore: use vite plus (#33407) 2026-03-13 18:18:44 +08:00
postcss.config.js
proxy.ts chore: fix load env and treeshaking for vinext (#32928) 2026-03-04 10:07:29 +08:00
tailwind-common-config.ts fix: stop responding icon not display (#33154) 2026-03-09 16:27:45 +08:00
tailwind-css-plugin.ts
tailwind.config.js refactor: replace react markdown with streamdown (#32971) 2026-03-10 17:02:37 +08:00
taze.config.js chore: add dev proxy server, update deps (#33371) 2026-03-13 12:52:19 +08:00
tsconfig.json
tsslint.config.ts
typography.js
vite.config.ts chore: use vite plus (#33407) 2026-03-13 18:18:44 +08:00
vitest.setup.ts chore(deps): bump the npm-dependencies group across 1 directory with 55 updates (#33170) 2026-03-09 23:24:36 +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.

[!TIP] It is recommended to install and enable Corepack to manage package manager versions automatically:

npm install -g corepack
corepack enable

Learn more: Corepack

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

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.

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