A modern, responsive web interface has been implemented for the Stable Diffusion REST API server.
The web UI is now integrated into the REST server and served at /ui. The web UI is automatically built when you build the server!
mkdir build && cd build
cmake ..
cmake --build .
The web UI will be automatically built and placed in build/webui/.
Note: Node.js and npm must be installed for the web UI to build. If npm is not found, the build will continue without the web UI.
./src/stable-diffusion-rest-server \
--models-dir /path/to/models \
--checkpoints checkpoints \
--ui-dir ../webui
Note: You must explicitly specify --ui-dir to enable the web UI. The path should point to the built static files in build/webui/.
Dynamic Configuration: The web UI automatically detects the server's host and port at runtime! No need to rebuild the UI when changing ports - just start the server on any port and the UI will work automatically.
Navigate to http://localhost:8080/ui/
The web UI will be served directly by the REST server at the /ui path!
The web UI automatically adapts to any port you specify:
# Run on port 3000
./src/stable-diffusion-rest-server \
--models-dir /path/to/models \
--checkpoints checkpoints \
--ui-dir ../webui \
--port 3000
# Access at http://localhost:3000/ui/
No rebuild required! The UI automatically detects the server configuration at runtime.
You can control the web UI build with CMake options:
# Disable web UI building
cmake .. -DBUILD_WEBUI=OFF
# Enable web UI building (default)
cmake .. -DBUILD_WEBUI=ON
If you want to specify a custom UI directory:
./src/stable-diffusion-rest-server \
--models-dir /path/to/models \
--checkpoints checkpoints \
--ui-dir /path/to/custom/ui
For development or if you prefer to run the web UI separately:
cd webui
npm install
For standalone development mode, you need to configure the API endpoint.
Edit .env.local and uncomment:
NEXT_PUBLIC_API_URL=http://localhost:8080
NEXT_PUBLIC_API_BASE_PATH=/api
Note: This is only needed when running npm run dev. In production (integrated mode), the server automatically injects the configuration.
npm run dev
Navigate to http://localhost:3000
The web UI includes the following features:
npm run build
npm start
The production server will run on port 3000 by default.
PORT=3001 npm start
webui/
├── app/ # Next.js 15 App Router pages
│ ├── text2img/ # Text-to-image generation
│ ├── img2img/ # Image-to-image transformation
│ ├── upscaler/ # Image upscaling
│ ├── models/ # Model management
│ ├── queue/ # Queue monitoring
│ └── page.tsx # Home page
├── components/ # React components
│ ├── ui/ # Reusable UI components
│ ├── sidebar.tsx # Navigation
│ ├── header.tsx # Page headers
│ ├── theme-toggle.tsx # Theme switcher
│ └── ...
├── lib/ # Utilities
│ ├── api.ts # API client
│ └── utils.ts # Helper functions
└── public/ # Static assets
The web UI expects the following API endpoints to be available:
GET /api/v1/health - Health checkGET /api/v1/models - List modelsPOST /api/v1/text2img - Generate from textPOST /api/v1/img2img - Transform imagesGET /api/v1/queue - Queue statusGET /api/v1/jobs/{id} - Job statusPOST /api/v1/models/load - Load modelMake sure your REST API server is running and accessible before using the web UI.
For detailed development information, see webui/README.md.
.env.local.next folder and node_modulesnpm install againFor more information, see the full documentation in the webui directory.
The web UI uses a dynamic configuration system that eliminates the need to rebuild when changing ports or hosts:
--ui-dir, it automatically serves a /ui/config.js endpointBenefits:
.env configuration required in productionExample config.js generated by server:
window.__SERVER_CONFIG__ = {
apiUrl: 'http://localhost:8080',
apiBasePath: '/api',
host: 'localhost',
port: 8080
};
This configuration is automatically loaded before the UI initializes, ensuring all API requests go to the correct server endpoint.