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

109+
Endpoints
18
Controllers
51
Entities
26
Kafka Topics

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

FeatureTransportUse Case
Training ProgressSSE (GET /training/jobs/:id/stream)Live loss/accuracy charts during training
Training WebSocketWebSocket (ws://…/ws/training)Bi-directional training updates
Drift AlertsKafka → notify-svc → pushModel drift detected notification
Training CompleteKafka → notify-svc → pushJob completion notification
Governance UpdatesKafka → notify-svc → pushModel 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/SectionAPI FeaturesComponents
ML Model RegistryGET /models, POST /models, GET /models/:id, POST /models/:id/versionsTableA (model list), DialogA (create form), BadgeA (status)
Training DashboardPOST /training/jobs, GET /training/jobs, GET /training/jobs/:id/stream (SSE)TableA (job list), live progress chart, ButtonA (start/stop)
Inference PlaygroundPOST /inference/predict, POST /inference/endpointsTextareaF1 (JSON input), ButtonA (predict), JSON response viewer
Drift MonitoringGET /drift/monitors, GET /drift/reports, POST /drift/detectTableA (monitors), chart widgets (PSI scores), AlertA (drift detected)
A/B ExperimentsPOST /experiments, GET /experiments/:id/resultsTableA (experiments), DialogA (create), results chart
Feature StorePOST /feature-store/online, POST /feature-store/materializeTableA (feature groups), ButtonA (materialize)
Model GovernancePOST /governance/model-cards, GET /governance/models/:modelId/complianceMulti-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

DirectionServiceProtocolData Flow
Upstreamwallet-svcHTTP SDKCredit check, deduction, refund
UpstreamSageMaker (AWS)AWS SDKTraining jobs, HPO, batch transform
Upstreamllm-orch-svcHTTP SDKAI-assisted HPO (AutoML)
UpstreamNeptune (AWS)Gremlin/HTTPSKG queries, decision recording
Downstreamsearch-svcHTTP SDKML-powered search ranking
Downstreamevent-svcHTTP SDKEvent recommendation models
Event Consumernotify-svcKafkaTraining, drift, governance alerts
Event Consumeranalytics-svcKafkaML usage telemetry

Training Workflow

Training job lifecycletext
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 user
SSE training stream (React hook)typescript
const 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 };
};
SDK usage exampletypescript
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

FeatureBaseStudentStartUpProProMaxEnterprise
Model Registration251050
Training Jobs/month520100
Inference Endpoints1520
A/B Experiments310
Drift Monitors520
AutoML
Governance
Canary Deployments

Credit Costs

OperationCreditsUSD Equivalent
Model registration2$0.0002
Model version creation5$0.0005
Training job (base)50$0.005
Training (per GPU-hour)20 × multiplierVaries
HPO tuning (base)100$0.01
Create inference endpoint30$0.003
Prediction (small)1$0.0001
Prediction (medium)3$0.0003
Prediction (large)10$0.001
A/B experiment (base)15$0.0015
Evaluation10$0.001
AutoML job200+$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

ElementComponentNotes
Model tableTableAname, framework, version, status
Status badgeBadgeAGreen=ACTIVE, Yellow=STAGING, Red=ARCHIVED
Create buttonButtonAOpens create dialog
Framework selectorSelectAPyTorch, TensorFlow, Sklearn, ...
Tag chipsBadgeAModel metadata tags

Training Dashboard

ElementComponentNotes
Job tableTableAmodel, status, instance, epoch, loss
Status badgeBadgeARUNNING=Blue, COMPLETED=Green, FAILED=Red
Instance selectorSelectACPU (m5.*), GPU (p3.*, p4d.*)
Progress chartChart widgetLive loss/accuracy via SSE
Metrics cardsCardD1Loss, accuracy, time, credits

Drift Monitoring

ElementComponentNotes
Monitor tableTableAmodel, drift type, threshold, status
PSI chartChart widgetPer-feature PSI with threshold line
Drift alertAlertARed alert with affected features
Detection methodSelectAPSI, KS_TEST, DDM, ADWIN

Governance Console

ElementComponentNotes
Model cards tableTableAmodel, status, author, reviewer
Model card formMulti-step formDetails → Use → Data → Fairness
Compliance checklistCustomGreen/red per requirement
Approve buttonButtonAWith mandatory comment
Reject buttonButtonBWith 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.