Architecture & API Design
Interlingo

Architecture

Overview

The Customer360 Lifecycle Management feature introduces a new microservice that centralizes customer lifecycle tracking across CRM, Billing, and Support systems. The architecture follows an event-driven, modular, and secure-by-default approach.

Components

  1. customer-lifecycle-service (New Microservice)

    1. Responsible for:

      1. Managing lifecycle state transitions

      2. Serving API requests related to customer status

      3. Listening to domain events (e.g. customer created, contract renewed)

      4. Built with: Node.js (Express) or Java Spring Boot

      5. Connected to a PostgreSQL database and Redis for caching

  2. Message Queue Integration

    1. Uses Kafka topics for event-driven communication:

      1. customer.created

      2. customer.updated

      3. contract.renewed

      4. support.issue.closed

  3. Redis Cache

    1. Stores recent lifecycle data for fast retrieval in UI

    2. TTL: 5 minutes for summary views, 24 hours for full profiles

  4. Audit & Logging Layer

    1. Centralized logging using ELK stack

    2. Lifecycle changes are sent to an audit.lifecycle.updated Kafka topic


Diagram (ASCII-friendly)

┌────────────────────┐ │ CRM Service │ └────────┬───────────┘ │ ▼ ┌────────────────────┐ │ Kafka: customer.* │◄──── Support / Billing └────────┬───────────┘ ▼ ┌─────────────────────────────┐ │ customer-lifecycle-service │ ├─────────────────────────────┤ │ REST API │ │ Kafka Consumer │ │ Postgres (state store) │ │ Redis (summary cache) │ └────────┬────────────────────┘ ▼ ┌──────────────────────┐ │ Audit Service / ELK │ └──────────────────────┘ ▲ │ ┌──────────────────────────────┐ │ WiseApp UI - Customer360 Tab │ └──────────────────────────────┘

API Specifications

Update Lifecycle Stage

Endpoint:
PATCH /api/v1/customers/{id}/lifecycle

Request Payload:

{ "stage": "At-Risk", "updated_by": "user-42" }

Response:

{ "success": true, "updated_at": "2025-07-28T12:34:00Z" }

Errors:

  • 400 Bad Request (invalid stage)

  • 403 Forbidden (insufficient permissions)

  • 500 Internal Server Error