Skip to main content

ADR-001: CRM Module Architecture Pattern

Status

Accepted

Context

We need to integrate a comprehensive CRM system into our existing QR Contact Card Generator platform. The CRM must support viral growth mechanics, AI-powered enrichment, and social graph visualization while maintaining performance at scale.

Decision

We will implement the CRM as a modular microservice within the existing monolith, following a hybrid architecture pattern that allows for future extraction into a standalone service.

Architecture Pattern: Modular Monolith with Service Boundaries

Platform Monolith
├── Core Services (existing)
│ ├── User Management
│ ├── QR Generator
│ └── Analytics
└── CRM Module (new)
├── Contact Service
├── Enrichment Service
├── Social Graph Service
└── Viral Engine

Rationale

  1. Gradual Migration Path: Start within monolith, extract when needed
  2. Shared Infrastructure: Reuse auth, billing, and database connections
  3. Faster Development: No inter-service communication overhead initially
  4. Clear Boundaries: Service interfaces defined for future extraction
  5. Performance: In-process calls faster than network calls

Consequences

Positive

  • Faster time to market
  • Easier debugging and testing
  • Shared transaction boundaries
  • No network latency for CRM operations
  • Simpler deployment initially

Negative

  • Coupled deployments initially
  • Shared resource constraints
  • Potential for boundary violations
  • Refactoring needed for extraction

Implementation Guidelines

  1. Clear Module Boundaries: Use Rust modules with public interfaces
  2. Database Separation: CRM tables in separate schema
  3. Event-Driven Communication: Use internal event bus
  4. Dependency Injection: Prepare for service extraction
  5. API Versioning: Design APIs for external consumption

Alternatives Considered

  1. Separate Microservice: Rejected due to complexity overhead
  2. Embedded Library: Rejected due to limited scalability
  3. Third-party CRM: Rejected due to viral mechanics requirements