# Blocklist Service Design Challenge
## Overview
Develop a versatile Blocklist Service capable of preventing fraud by evaluating both user activities and user data against predefined rules. This service is intended for use in diverse applications, such as Merchant Products or E-commerce Products. Fraud Ops will define rules through an Ops Portal, and the Blocklist Service will employ these rules to determine if a given user should be blocked.
## Key Components
### 1. Blocklist Service:
- Evaluates both user data and activities based on predefined rules.
- Accommodates both synchronous and asynchronous evaluation requests.
- Fetches user data and activity data from the User Service.
### 2. Ops Portal:
- Web interface for Fraud Ops to define and manage rules.
- Supports complex rule sets with logical conditions.
- Allows blacklisting based on various criteria such as emails, last login IP, phone number, country, etc.
### 3. User Service:
- Stores user data and activity data.
- Provides APIs for the Blocklist Service to retrieve necessary data.
### 4. Client (Merchant/E-commerce Product):
- Initiates requests to the Blocklist Service for user evaluation.
## Workflow
### 1. Rule Definition:
- Fraud Ops use the Ops Portal to define rules.
- Rules include conditions like sequential evaluations, logical AND, OR conditions, and blacklisting based on various criteria.
### 2. Data Fetching:
- Blocklist Service fetches user data and activity data from the User Service based on the evaluation request.
### 3. Rule Evaluation:
- Blocklist Service checks the user against predefined rules.
- The evaluation can be done sequentially or with logical conditions based on the rule definitions.
### 4. Response to Client:
- The evaluation result is sent back to the client, indicating whether the user should be blocked.
- Additional details on which rule(s) triggered the block may be provided.
## Communication
- Ops Portal communicates rule configurations to the Blocklist Service.
- Blocklist Service communicates with the User Service to fetch necessary data.
- Clients (Merchant/E-commerce Product) initiate evaluation requests.
## Additional Considerations
- Implement suitable communication protocols for service interactions.
- Ensure secure communication practices.
- Address scalability concerns for handling growing evaluation requests.
- Consider logging and monitoring mechanisms for debugging and auditing.
## Emphasis on Generality
The Blocklist Service should be designed with generic use in mind, providing flexibility for various applications and ensuring ease of integration with different products.