A modern, full-featured React 19 TypeScript web interface has been created for the NGINX Declarative API v5.5. The UI provides a user-friendly way to manage NGINX configurations through the declarative API.
- ✅ JWT-based authentication
- ✅ Token stored in localStorage (with security disclaimer)
- ✅ Protected routes
- ✅ Automatic token injection in API requests
- ✅ Auto-logout on 401 errors
- ✅ Login Page - JWT token input with validation
- ✅ Dashboard - Overview of configurations with status monitoring
- ✅ Create Configuration - JSON editor for creating new configs
- ✅ Configuration Management - View, edit, delete operations
All v5.5 endpoints are integrated:
- ✅ POST /v5.5/config - Create configuration
- ✅ GET /v5.5/config/{configUid} - Retrieve configuration
- ✅ PATCH /v5.5/config/{configUid} - Update configuration
- ✅ DELETE /v5.5/config/{configUid} - Delete configuration
- ✅ GET /v5.5/config/{configUid}/status - Get status
- ✅ GET /v5.5/config/{configUid}/submission/{submissionUid} - Get async submission status
- ✅ Test setup with Vitest
- ✅ Component tests (LoginPage)
- ✅ Store tests (AuthStore)
- ✅ Hook tests (useConfig)
- ✅ Coverage reporting configured
- ✅ Docker support with multi-stage build
- ✅ NGINX reverse proxy configuration
- ✅ Integration with docker-compose
- ✅ Configurable ports
- ✅ Development and production builds
webui/
├── src/
│ ├── api/ # API client layer
│ │ └── config.ts # Config API methods
│ ├── components/ # Reusable components
│ │ ├── Header.tsx
│ │ ├── Layout.tsx
│ │ └── ProtectedRoute.tsx
│ ├── hooks/ # Custom React hooks
│ │ └── useConfig.ts # React Query hooks for API
│ ├── lib/ # Libraries & utilities
│ │ └── axios.ts # Axios instance with interceptors
│ ├── pages/ # Page components
│ │ ├── LoginPage.tsx
│ │ ├── DashboardPage.tsx
│ │ └── CreateConfigPage.tsx
│ ├── store/ # State management
│ │ └── authStore.ts # Zustand auth store
│ ├── test/ # Test files
│ │ ├── setup.ts
│ │ ├── LoginPage.test.tsx
│ │ ├── authStore.test.ts
│ │ └── useConfig.test.tsx
│ ├── types/ # TypeScript definitions
│ │ └── index.ts # API & app types
│ ├── App.tsx # Main app with routing
│ ├── main.tsx # Entry point
│ └── index.css # Global styles
├── Dockerfile # Production Docker build
├── nginx.conf # NGINX config for production
├── vite.config.ts # Vite configuration
├── tsconfig.json # TypeScript config
├── package.json # Dependencies
└── README.md # Web UI documentation
| Category | Technology | Purpose |
|---|---|---|
| Framework | React 19 | UI library |
| Language | TypeScript | Type safety |
| Build Tool | Vite | Fast dev server & build |
| Routing | React Router v7 | Client-side routing |
| State Management | Zustand | Auth state |
| Server State | TanStack Query | API state & caching |
| HTTP Client | Axios | API requests |
| UI Feedback | React Hot Toast | Notifications |
| Testing | Vitest + Testing Library | Unit & component tests |
| Code Quality | ESLint + Prettier | Linting & formatting |
cd webui
npm install
npm run devAccess at http://localhost:3000
npm test # Run tests
npm run test:ui # Test UI
npm run test:coverage # Coverage reportnpm run build
npm run preview# From repo root
cd contrib/docker-compose
# Build all images including Web UI
./nginx-dapi.sh -c build
# Start with default ports
./nginx-dapi.sh -c start
# Start with custom ports
./nginx-dapi.sh -c start -a 8080 -w 8081 -d 8082 -r 6380Access Points:
- Web UI: http://localhost:3000 (or custom port)
- API: http://localhost:5000 (or custom port)
- DevPortal: http://localhost:5001 (or custom port)
Current Implementation (Development):
- JWT tokens stored in localStorage
- Simple Bearer token authentication
- CORS handled by backend
- Use HTTP-only cookies for token storage
- Implement token refresh mechanism
- Add CSRF protection
- Enable rate limiting
- Use HTTPS/TLS in production
- Implement proper session management
- Add input validation and sanitization
- Consider OAuth2/OIDC for enterprise use
The UI includes comprehensive TypeScript types based on the OpenAPI spec:
interface ConfigDeclaration {
output?: {
type?: 'nms' | 'nginxone';
license?: LicenseConfig;
nms?: NMSConfig;
nginxone?: NginxOneConfig;
};
declaration?: {
http?: HttpConfig[];
layer4?: Layer4Config[];
resolvers?: ResolverConfig[];
};
}Theme: Dark mode with gradient backgrounds
Color Scheme:
- Primary:
#646cff(purple-blue) - Success:
#34c759(green) - Error:
#ff3b30(red) - Background: Gradient from
#1a1a2eto#16213e
Key Features:
- Glassmorphism effects
- Smooth animations and transitions
- Responsive grid layouts
- Status indicators with color coding
- Monaco-style code editor aesthetics
User Action → React Component → React Query Hook → API Service → Axios → Backend API
↓
Cache & State Update
↓
UI Re-render
Tests implemented for:
- ✅ Authentication store (login/logout)
- ✅ Login page rendering
- ✅ Config creation hook
- ✅ API service layer (mocked)
Run npm run test:coverage for detailed coverage report.
Client State (Zustand):
- Authentication state
- User token
- Login/logout actions
Server State (TanStack Query):
- Configuration data
- Status monitoring
- Submission tracking
- Automatic refetching
- Optimistic updates
Development (Vite):
'/v5.5': {
target: 'http://localhost:5000',
changeOrigin: true,
}Production (NGINX):
location /v5.5/ {
proxy_pass http://nginx-dapi:5000;
# ... proxy headers
}-
Build stage: Node.js 24 Alpine
- Install dependencies
- Build production bundle
-
Production stage: NGINX Alpine
- Copy built files
- Serve with NGINX
- Proxy API requests to backend
- Form builder for visual config creation
- Configuration templates library
- Bulk operations
- Configuration diff viewer
- Export/import configurations
- Real-time collaboration
- Audit log viewer
- Advanced search and filtering
- Configuration validation preview
- Integration with CI/CD pipelines
- HTTP-only cookie authentication
- Token refresh mechanism
- WebSocket support for real-time updates
- Advanced Monaco editor integration
- Configuration schema validation
- Offline support with service workers
- Internationalization (i18n)
- Accessibility (WCAG 2.1 AA)
- Web UI README - Detailed Web UI documentation
- USAGE-v5.5.md - API v5.5 usage guide
- Docker Compose README - Deployment guide
- OpenAPI Spec - Complete API specification
When contributing to the Web UI:
- Follow TypeScript best practices
- Write tests for new features
- Use Prettier for code formatting
- Update type definitions when API changes
- Document new components and hooks
- Ensure accessibility standards
Apache License 2.0 - See LICENSE.md
Built with ❤️ for the NGINX Declarative API project