dify/web
yyh 323654afe2
fix: align member invitation flow and API contracts (#38856)
Co-authored-by: autofix-ci[bot] <114827586+autofix-ci[bot]@users.noreply.github.com>
2026-07-13 15:16:23 +00:00
..
__mocks__ chore: migrate linting to vp lint with ESLint fallback (#38834) 2026-07-13 06:41:53 +00:00
__tests__ fix(auth): prevent open redirects in post-login flows (#38864) 2026-07-13 10:11:36 +00:00
.storybook chore: migrate static checks to vp check (#38850) 2026-07-13 08:00:39 +00:00
.vscode chore: migrate formatting to vp fmt (#38705) 2026-07-12 14:59:00 +00:00
app fix: align member invitation flow and API contracts (#38856) 2026-07-13 15:16:23 +00:00
assets
bin style: format with vp fmt (#38803) 2026-07-12 15:57:46 +00:00
config style: format with vp fmt (#38803) 2026-07-12 15:57:46 +00:00
constants
context fix(auth): prevent open redirects in post-login flows (#38864) 2026-07-13 10:11:36 +00:00
docker chore: set NEXT_PUBLIC_ENABLE_FEATURE_PREVIEW default to true (#38362) 2026-07-07 02:20:15 +00:00
docs chore: migrate static checks to vp check (#38850) 2026-07-13 08:00:39 +00:00
features chore: add skill upload fail tip (#38851) 2026-07-13 07:52:12 +00:00
hooks style: format with vp fmt (#38803) 2026-07-12 15:57:46 +00:00
i18n fix: align member invitation flow and API contracts (#38856) 2026-07-13 15:16:23 +00:00
i18n-config fix: align member invitation flow and API contracts (#38856) 2026-07-13 15:16:23 +00:00
models fix: align member invitation flow and API contracts (#38856) 2026-07-13 15:16:23 +00:00
next feat(web): refine onboarding UI (#37433) 2026-06-15 08:47:15 +00:00
plugins chore: migrate linting to vp lint with ESLint fallback (#38834) 2026-07-13 06:41:53 +00:00
public style: format with vp fmt (#38803) 2026-07-12 15:57:46 +00:00
scripts chore: migrate linting to vp lint with ESLint fallback (#38834) 2026-07-13 06:41:53 +00:00
service fix: align member invitation flow and API contracts (#38856) 2026-07-13 15:16:23 +00:00
test style: format with vp fmt (#38803) 2026-07-12 15:57:46 +00:00
themes style: format with vp fmt (#38803) 2026-07-12 15:57:46 +00:00
types chore: migrate static checks to vp check (#38850) 2026-07-13 08:00:39 +00:00
utils fix(auth): prevent open redirects in post-login flows (#38864) 2026-07-13 10:11:36 +00:00
.env.example feat: daily sync (#38593) 2026-07-09 10:35:15 +00:00
.gitignore chore: ignore .vinext (#36914) 2026-06-02 02:43:15 +00:00
AGENTS.md chore(agent-v2): sync changes (#38513) 2026-07-08 12:05:04 +00:00
CLAUDE.md
dev-proxy.config.ts style: format with vp fmt (#38803) 2026-07-12 15:57:46 +00:00
Dockerfile fix(docker): pin web docker node version (#36756) 2026-05-28 05:25:41 +00:00
Dockerfile.dockerignore build: include packages in docker build (#34532) 2026-04-03 13:40:16 +00:00
env.ts style: format with vp fmt (#38803) 2026-07-12 15:57:46 +00:00
global.d.ts refactor(chat): modernize speech-to-text pipeline (#38653) 2026-07-13 04:21:29 +00:00
instrumentation-client.ts style: format with vp fmt (#38803) 2026-07-12 15:57:46 +00:00
knip.config.ts chore: migrate linting to vp lint with ESLint fallback (#38834) 2026-07-13 06:41:53 +00:00
next.config.ts style: format with vp fmt (#38803) 2026-07-12 15:57:46 +00:00
oxlint.unused.config.json chore: migrate linting to vp lint with ESLint fallback (#38834) 2026-07-13 06:41:53 +00:00
package.json fix: align member invitation flow and API contracts (#38856) 2026-07-13 15:16:23 +00:00
postcss.config.js refactor: update to tailwind v4 (#34415) 2026-04-02 07:06:11 +00:00
proxy.ts chore: migrate linting to vp lint with ESLint fallback (#38834) 2026-07-13 06:41:53 +00:00
README.md chore: upgrade TypeScript 7 (#38575) 2026-07-09 01:42:40 +00:00
tsconfig.json chore: migrate static checks to vp check (#38850) 2026-07-13 08:00:39 +00:00
tsslint.config.ts style: format with vp fmt (#38803) 2026-07-12 15:57:46 +00:00
vite.config.ts style: format with vp fmt (#38803) 2026-07-12 15:57:46 +00:00
vitest.setup.ts style: format with vp fmt (#38803) 2026-07-12 15:57:46 +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:

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.