Skip to content

CRM Service API

πŸ‘₯

A comprehensive customer relationship management REST API built with Java, Spring Boot, and PostgreSQL. Manages customer profiles, interactions, sales pipelines, and customer lifecycle management.


Features

Feature Description Icon
Customer Profiles Manage detailed customer information and history πŸ‘€
Interaction Tracking Log calls, emails, meetings, and touchpoints πŸ“ž
Sales Pipeline Track opportunities through sales stages πŸ“ˆ
Activity Management Manage tasks, follow-ups, and calendar items πŸ“…
Customer Segmentation Segment customers by attributes and behavior πŸ“Š
Integration Hooks Connect with email, calendar, and communication tools πŸ”—
Multi-Tenant Support Isolate customer data per tenant 🏒

Architecture Overview

flowchart TD
    A[Client] -->|REST API| B(CRMController)
    B --> C[CustomerService]
    C --> D[InteractionService]
    C --> E[PipelineService]
    D --> F[CustomerRepository]
    D --> G[InteractionRepository]
    E --> H[OpportunityRepository]
    F --> I[(PostgreSQL)]
    G --> I
    H --> I
Hold "Alt" / "Option" to enable pan & zoom

API Endpoints

Note: Real API endpoints to be provided and included here.

Method Endpoint Description Notes/Parameters
POST /api/v1/customers Create customer tenantId header, customer data
GET /api/v1/customers/{id} Get customer details
POST /api/v1/interactions Log customer interaction Interaction type and details
POST /api/v1/opportunities Create sales opportunity Customer ID, opportunity data

Sequence: Create Customer

sequenceDiagram
    participant U as User
    participant API as CRMController
    participant S as CustomerService
    participant R as CustomerRepository
    participant I as InteractionService
    U->>API: POST /customers (name, email, phone)
    API->>S: validate customer data
    S->>R: save customer profile
    R-->>S: customer created
    S->>I: log customer creation interaction
    I-->>S: interaction logged
    S-->>API: CustomerResponse
    API-->>U: 201 Created + customer details
Hold "Alt" / "Option" to enable pan & zoom

Database Schema

erDiagram
    customers {
        UUID id PK
        UUID tenant_id
        VARCHAR first_name
        VARCHAR last_name
        VARCHAR email
        VARCHAR phone
        VARCHAR company
        VARCHAR customer_segment
        TIMESTAMP created
        TIMESTAMP updated
    }

    interactions {
        UUID id PK
        UUID customer_id FK
        UUID tenant_id
        VARCHAR interaction_type
        TEXT description
        TIMESTAMP interaction_date
        VARCHAR initiated_by
        TIMESTAMP created
    }

    opportunities {
        UUID id PK
        UUID customer_id FK
        UUID tenant_id
        VARCHAR opportunity_name
        DECIMAL amount
        VARCHAR stage
        DATE expected_close_date
        VARCHAR probability
        TIMESTAMP created
        TIMESTAMP updated
    }

    customers ||--o{ interactions : "has"
    customers ||--o{ opportunities : "has"
Hold "Alt" / "Option" to enable pan & zoom

Getting Started

Prerequisites

  • Java 17+
  • PostgreSQL
  • Gradle

Setup

git clone https://github.com/Olanna-tech/crm-service-java.git
cd crm-service-java
./gradlew build

Database

  • Configure your PostgreSQL credentials in src/main/resources/application.yml.
  • Run Flyway migrations (auto on startup).

Run

./gradlew bootRun

Configuration

Set the following environment variables in application.yml:

crm:
  email-sync-enabled: true
  calendar-integration: google-calendar
  pipeline-stages: Lead,Qualified,Proposal,Negotiation,Closed
  activity-retention-days: 365


Contributing

Pull requests are welcome! For major changes, please open an issue first.


License

MIT


Contact