Frontend Integration Guide
Comprehensive guide for integrating eventml-svc across all 7 portals and mobile apps. Covers feature inventory, portal mapping, inter-service workflows, settings, and UI/UX recommendations.
Service Overview
Client SDK
Use @eventzr/eventml-client v2.1.0 (121 methods) for all frontend integration. Never call endpoints directly with fetch/axios.
Real-Time Features
| Feature | Transport | Use Case |
|---|---|---|
| Training Progress | SSE (GET /training/jobs/:id/stream) | Live loss/accuracy charts during training |
| Training WebSocket | WebSocket (ws://…/ws/training) | Bi-directional training updates |
| Drift Alerts | Kafka → notify-svc → push | Model drift detected notification |
| Training Complete | Kafka → notify-svc → push | Job completion notification |
| Governance Updates | Kafka → notify-svc → push | Model card approval/rejection |
Portal Mapping
Each portal uses different eventml-svc features based on its design intent and target audience.
subscriber-portal
Task-oriented, data-dense, fast workflows| Page/Section | API Features | Components |
|---|---|---|
| ML Model Registry | GET /models, POST /models, GET /models/:id, POST /models/:id/versions | TableA (model list), DialogA (create form), BadgeA (status) |
| Training Dashboard | POST /training/jobs, GET /training/jobs, GET /training/jobs/:id/stream (SSE) | TableA (job list), live progress chart, ButtonA (start/stop) |
| Inference Playground | POST /inference/predict, POST /inference/endpoints | TextareaF1 (JSON input), ButtonA (predict), JSON response viewer |
| Drift Monitoring | GET /drift/monitors, GET /drift/reports, POST /drift/detect | TableA (monitors), chart widgets (PSI scores), AlertA (drift detected) |
| A/B Experiments | POST /experiments, GET /experiments/:id/results | TableA (experiments), DialogA (create), results chart |
| Feature Store | POST /feature-store/online, POST /feature-store/materialize | TableA (feature groups), ButtonA (materialize) |
| Model Governance | POST /governance/model-cards, GET /governance/models/:modelId/compliance | Multi-step form (model card), compliance checklist |
Indirect Access
visitor-portal, event-discovery-mobile, and partner-portal interact with eventml-svc indirectly through other services (search-svc for ranking, event-svc for recommendations). No direct API calls from these apps.
Inter-Service Integration
| Direction | Service | Protocol | Data Flow |
|---|---|---|---|
| Upstream | wallet-svc | HTTP SDK | Credit check, deduction, refund |
| Upstream | SageMaker (AWS) | AWS SDK | Training jobs, HPO, batch transform |
| Upstream | llm-orch-svc | HTTP SDK | AI-assisted HPO (AutoML) |
| Upstream | Neptune (AWS) | Gremlin/HTTPS | KG queries, decision recording |
| Downstream | search-svc | HTTP SDK | ML-powered search ranking |
| Downstream | event-svc | HTTP SDK | Event recommendation models |
| Event Consumer | notify-svc | Kafka | Training, drift, governance alerts |
| Event Consumer | analytics-svc | Kafka | ML usage telemetry |
Training Workflow
Frontend (subscriber-portal)
│
├─ POST /training/jobs (with config + hyperparameters)
│
▼
eventml-svc
├─ 1. Check credits (wallet-svc) ─ 50 base + dynamic
├─ 2. Create SageMaker training job (AWS SDK)
├─ 3. SSE stream: epoch metrics (loss, accuracy)
├─ 4. Job completes → deduct credits
├─ 5. Kafka: eventzr.eventml.training.completed.v1
└─ 6. notify-svc → push notification to userconst useTrainingStream = (jobId: string) => {
const [metrics, setMetrics] = useState<TrainingMetric[]>([]);
const [status, setStatus] = useState<'idle' | 'streaming' | 'completed'>('idle');
useEffect(() => {
if (!jobId) return;
setStatus('streaming');
const es = new EventSource(
`${EVENTML_URL}/training/jobs/${jobId}/stream`,
{ headers: { Authorization: `Bearer ${token}` } }
);
es.addEventListener('progress', (e) => {
setMetrics((prev) => [...prev, JSON.parse(e.data)]);
});
es.addEventListener('completed', (e) => {
setMetrics((prev) => [...prev, JSON.parse(e.data)]);
setStatus('completed');
es.close();
});
return () => es.close();
}, [jobId]);
return { metrics, status };
};import { EventmlClient } from '@eventzr/eventml-client';
const client = new EventmlClient({
baseUrl: process.env.NEXT_PUBLIC_EVENTML_URL,
tenantId: user.tenantId,
});
// Create model
const model = await client.createModel(tenantId, {
name: 'event-recommender',
framework: 'PYTORCH',
taskType: 'RECOMMENDATION',
modelType: 'CUSTOM',
});
// Start training
const job = await client.createTrainingJob(tenantId, {
modelId: model.id,
jobType: 'FULL_TRAINING',
resourceConfig: { instanceType: 'ml.m5.large', instanceCount: 1 },
hyperparameters: { learningRate: 0.001, epochs: 50 },
});
// Real-time prediction
const prediction = await client.predict(tenantId, {
endpointId: 'endpoint-uuid',
input: { features: [1.0, 2.5, 3.7] },
});Subscription Tiers
| Feature | Base | Student | StartUp | Pro | ProMax | Enterprise |
|---|---|---|---|---|---|---|
| Model Registration | 2 | 5 | 10 | 50 | ∞ | ∞ |
| Training Jobs/month | — | — | 5 | 20 | 100 | ∞ |
| Inference Endpoints | — | — | 1 | 5 | 20 | ∞ |
| A/B Experiments | — | — | — | 3 | 10 | ∞ |
| Drift Monitors | — | — | — | 5 | 20 | ∞ |
| AutoML | — | — | — | — | ✓ | ✓ |
| Governance | — | — | — | — | ✓ | ✓ |
| Canary Deployments | — | — | — | — | ✓ | ✓ |
Credit Costs
| Operation | Credits | USD Equivalent |
|---|---|---|
| Model registration | 2 | $0.0002 |
| Model version creation | 5 | $0.0005 |
| Training job (base) | 50 | $0.005 |
| Training (per GPU-hour) | 20 × multiplier | Varies |
| HPO tuning (base) | 100 | $0.01 |
| Create inference endpoint | 30 | $0.003 |
| Prediction (small) | 1 | $0.0001 |
| Prediction (medium) | 3 | $0.0003 |
| Prediction (large) | 10 | $0.001 |
| A/B experiment (base) | 15 | $0.0015 |
| Evaluation | 10 | $0.001 |
| AutoML job | 200+ | $0.02+ |
| Explainability (SHAP/LIME) | 5 | $0.0005 |
UI/UX Recommendations
Component Mapping
Always use variant-suffixed components from @eventzr/ui. Never use base names (Button, Card, Input).
ML Model Registry
| Element | Component | Notes |
|---|---|---|
| Model table | TableA | name, framework, version, status |
| Status badge | BadgeA | Green=ACTIVE, Yellow=STAGING, Red=ARCHIVED |
| Create button | ButtonA | Opens create dialog |
| Framework selector | SelectA | PyTorch, TensorFlow, Sklearn, ... |
| Tag chips | BadgeA | Model metadata tags |
Training Dashboard
| Element | Component | Notes |
|---|---|---|
| Job table | TableA | model, status, instance, epoch, loss |
| Status badge | BadgeA | RUNNING=Blue, COMPLETED=Green, FAILED=Red |
| Instance selector | SelectA | CPU (m5.*), GPU (p3.*, p4d.*) |
| Progress chart | Chart widget | Live loss/accuracy via SSE |
| Metrics cards | CardD1 | Loss, accuracy, time, credits |
Drift Monitoring
| Element | Component | Notes |
|---|---|---|
| Monitor table | TableA | model, drift type, threshold, status |
| PSI chart | Chart widget | Per-feature PSI with threshold line |
| Drift alert | AlertA | Red alert with affected features |
| Detection method | SelectA | PSI, KS_TEST, DDM, ADWIN |
Governance Console
| Element | Component | Notes |
|---|---|---|
| Model cards table | TableA | model, status, author, reviewer |
| Model card form | Multi-step form | Details → Use → Data → Fairness |
| Compliance checklist | Custom | Green/red per requirement |
| Approve button | ButtonA | With mandatory comment |
| Reject button | ButtonB | With mandatory reason |
Full Guide
The complete frontend integration guide with all DTO-to-form mappings, table column configs, and dashboard widget specifications is available at services/eventml-svc/docs/frontend-guide.md in the repository.