npm installnpm run buildnpm run build:widget
npm run serve:widget # preview demos at http://localhost:4173/test/demo-iife.html etc.npm run dev # Vite dev server with integrated backend (port 5173)
npm run dev:server # Standalone Express server with Redis (port 3001)This starts:
- ✅ Frontend + Backend: http://localhost:5173 (Vite Dev Server with integrated backend API)
- Backend routes (
/auth/*,/dqm/*) are handled by Vite plugin
Navigate to http://localhost:5173
The test harness is already configured to use the backend:
config={{
authBackendUrl: '', // Empty = same origin (backend integrated in Vite dev server)
useLocalStorage: true,
}}- Enter your Crownpeak DQM API Key
- Enter your Website ID
- Click "Continue"
The backend will:
- Validate credentials with Crownpeak DQM API
- Issue a session token
- Store token in localStorage
- Paste HTML in the editor
- Click "Start Analysis"
- All requests go through
/dqm/*on the same origin (port 5173 in dev)
graph LR
A[React App + Backend API<br/>Port 5173]
B[Vite Dev Server<br/>with integrated backend]
C[Crownpeak DQM<br/>API]
A -->|HTTP Requests| B
B -->|Proxied Requests| C
A -.->|sessionToken<br/>localStorage| A
B -.->|apiKey + websiteId<br/>in-memory · Redis-ready| B
subgraph Frontend
A
A1[DQMSidebar]
A2[Login UI]
A3[HTML Editor]
end
subgraph Backend
B
B1[Auth Routes]
B2[DQM Proxy]
B3[Sessions]
end
subgraph External
C
C1[Analysis]
C2[Highlights]
C3[Checkpoints]
end
config={{
authBackendUrl: '', // Dev: empty (same origin) | Prod: 'https://your-backend.com'
}}- ✅ Secure session tokens
- ✅ API keys remain server-side
- ✅ Centralized access control
config={{
apiKey: 'YOUR_API_KEY',
websiteId: 'YOUR_WEBSITE_ID',
}}- ✅ No backend required
- ✅ Quick testing
- ✅ Props or localStorage
POST /auth/login- Login with credentialsPOST /auth/logout- Invalidate sessionGET /auth/session- Get session info
POST /dqm/assets- Start analysisGET /dqm/assets/:id- Get resultsGET /dqm/assets/:id/pagehighlight/all- All highlightsGET /dqm/assets/:id/pagehighlight/:cpId- Single highlight
All DQM endpoints require Authorization: Bearer <sessionToken>
# Development
npm run dev # Vite dev server with integrated backend (port 5173)
npm run dev:client # Same as npm run dev
npm run dev:server # Standalone Express server with Redis (port 3001)
# Build
npm run build # Build all
npm run build:lib # Build React library
npm run build:server # Build Express server
# Production
npm run start:server # Run built serverCopy .env.example to .env:
PORT=3001
CORS_ORIGINS=http://localhost:5173
DQM_API_BASE_URL=https://api.crownpeak.net/dqm-cms/v1
JWT_SECRET=your-secret-key- BACKEND-API.md - Backend API specification
- DEVELOPMENT.md - Development guide
- server/README.md - Server documentation
- AUTHENTICATION.md - Auth flow details
- EXAMPLES.md - Integration examples
curl http://localhost:5173/healthcurl -X POST http://localhost:5173/auth/login \
-H "Content-Type: application/json" \
-d '{"apiKey":"YOUR_KEY","websiteId":"YOUR_ID"}'curl -X POST http://localhost:5173/dqm/assets \
-H "Authorization: Bearer YOUR_TOKEN" \
-H "Content-Type: application/json" \
-d '{"html":"<html><body>Test</body></html>"}'✅ Modular Backend - Express.js with clean architecture
✅ Session Management - In-memory store (Redis-ready)
✅ DQM API Proxy - All analysis endpoints
✅ CORS & Security - Helmet.js, CORS whitelist
✅ Auto-reload - TSX watch mode for development
✅ Concurrent Servers - Frontend + Backend in one command
✅ TypeScript - Full type safety
✅ Error Handling - Centralized middleware
MIT