A high-quality, production-ready Angular component library that visually compares two user profiles by highlighting their similarities and differences.
- Visual Profile Comparison: Three-column layout showing user interests with shared interests in the center
 - Text Similarity Analysis: Uses API Ninjas Text Similarity API to calculate interest similarities
 - Face Detection & Alignment: Detects faces in profile images and aligns them eye-to-eye
 - Interactive UI: Horizontal dragging with Swiper.js for overflow content
 - Responsive Design: Mobile-first design with glassmorphism effects
 - TypeScript Support: Fully typed with strict TypeScript interfaces
 - Production Ready: Environment-based configuration with proper error handling
 
npm install ngx-profile-comparisonCreate environment files in your Angular project:
environment.ts (Development)
export const environment = {
  production: false,
  apiKeys: {
    textSimilarity: 'YOUR_TEXT_SIMILARITY_API_KEY',
    faceDetection: 'YOUR_FACE_DETECTION_API_KEY'
  }
};environment.prod.ts (Production)
export const environment = {
  production: true,
  apiKeys: {
    textSimilarity: process.env['TEXT_SIMILARITY_API_KEY'] || '',
    faceDetection: process.env['FACE_DETECTION_API_KEY'] || ''
  }
};Get your API keys from API Ninjas:
- Text Similarity API: 
https://api.api-ninjas.com/v1/textsimilarity - Face Detection API: 
https://api.api-ninjas.com/v1/facedetect 
import { NgModule } from '@angular/core';
import { BrowserModule } from '@angular/platform-browser';
import { HttpClientModule } from '@angular/common/http';
import { ProfileComparisonComponent } from 'ngx-profile-comparison';
@NgModule({
  imports: [
    BrowserModule,
    HttpClientModule,
    ProfileComparisonComponent
  ],
  // ...
})
export class AppModule { }import { Component } from '@angular/core';
import { ProfileViewEvent } from 'ngx-profile-comparison';
@Component({
  selector: 'app-profile-demo',
  template: `
    <lib-profile-comparison
      [user1Interests]="user1Interests"
      [user2Interests]="user2Interests"
      [user3Interests]="user3Interests"
      [user1Image]="user1Image"
      [user2Image]="user2Image"
      [similarityThreshold]="0.8"
      (profileViewed)="onProfileViewed($event)"
    ></lib-profile-comparison>
  `
})
export class ProfileDemoComponent {
  user1Interests = ['Sushi', 'Travel', 'Photography'];
  user2Interests = ['Sushi', 'Cooking', 'Gardening'];
  user3Interests = ['Travel', 'Photography', 'Music'];
  user1Image = 'https://example.com/user1.jpg';
  user2Image = 'https://example.com/user2.jpg';
  onProfileViewed(event: ProfileViewEvent): boolean {
    console.log('Profile viewed:', event);
    return true;
  }
}| Property | Type | Description | 
|---|---|---|
user1Interests | 
string[] | 
Array of interests for User 1 | 
user2Interests | 
string[] | 
Array of interests for User 2 | 
user3Interests | 
string[] | 
Array of interests for User 3 (influences ordering) | 
user1Image | 
string | 
Image URL for User 1 | 
user2Image | 
string | 
Image URL for User 2 | 
similarityThreshold | 
number | 
Threshold for combining similar interests (default: 0.8) | 
| Event | Type | Description | 
|---|---|---|
profileViewed | 
ProfileViewEvent | 
Emitted when "View Profile" button is clicked | 
- ProfileComparisonService: Orchestrates the comparison logic
 - TextSimilarityService: Handles text similarity API calls
 - FaceDetectionService: Manages face detection and alignment
 - ConfigService: Manages API configuration and environment variables
 
- 
Interest Ordering Algorithm:
- User 3's interests influence vertical ordering
 - Similar interests are grouped together
 - Cross-user similarities determine center placement
 
 - 
Face Alignment:
- Detects faces using API Ninjas Face Detection
 - Calculates eye positions for alignment
 - Applies transforms for eye-to-eye positioning
 
 - 
Error Handling:
- Graceful fallbacks for API failures
 - User-friendly error states
 - Production-ready error boundaries
 
 
- Node.js 18+
 - Angular 17+
 - API Ninjas account
 
git clone https://github.com/your-username/ngx-profile-comparison.git
cd ngx-profile-comparison
npm install- Copy 
projects/app/src/environments/environment.ts.exampletoenvironment.ts - Add your API keys to the environment file
 - Never commit API keys to version control
 
ng serve app --port 4201Visit http://localhost:4201 to see the component in action.
ng build libng test libThe component uses API Ninjas Text Similarity API to calculate similarity scores between interests. This enables intelligent grouping and ordering of interests based on semantic similarity.
Face detection is performed using API Ninjas Face Detection API, which returns bounding box coordinates. The component uses these coordinates to align faces eye-to-eye for a more natural comparison view.
The component uses modern CSS features including:
- CSS Grid and Flexbox for layout
 - Glassmorphism effects with backdrop-filter
 - CSS custom properties for theming
 - Responsive design with mobile-first approach
 
- Chrome 90+
 - Firefox 88+
 - Safari 14+
 - Edge 90+
 
- Fork the repository
 - Create a feature branch
 - Make your changes
 - Add tests
 - Submit a pull request
 
MIT License - see LICENSE file for details
For support and questions:
- Create an issue on GitHub
 - Check the documentation
 - Review the demo application
 
- Initial release
 - Core profile comparison functionality
 - API integration with API Ninjas
 - Responsive design with Swiper.js
 - TypeScript support