This app helps anonymize customer data securely and efficiently.
This application anonymizes customer data, focusing on the following:
- Scrambles user details (e.g., names, emails, and phone numbers).
- Updates user orders with anonymized data.
- Deletes the customer profile after anonymization (optional).
- Integrated with Saleor via GraphQL API.
- Features
- Requirements
- Setup Instructions
- Running the Application
- Testing
- Docker Setup
- Project Structure
- Fetches user and order data using GraphQL APIs.
- Updates orders with anonymized details:
- First Name, Last Name → Replaced with placeholders.
- Email → Converted to a UUID-based format.
- Phone → Replaced with a non-functional number.
- Deletes customer data post-anonymization.
Ensure the following are installed before starting:
- Node.js (16+)
- pnpm
- Saleor CLI (optional)
Set the environment variable in a .env.local
file:
NEXT_PUBLIC_CUSTOMER_SCRAMBLE_DOMAIN=yourdomain.com
Variable Explanation:
NEXT_PUBLIC_CUSTOMER_SCRAMBLE_DOMAIN
: Specifies the domain for anonymized email addresses. Defaults toexample.com
.
-
Clone the repository:
git clone https://github.com/your-repo/anonymization-app.git cd anonymization-app
-
Install dependencies:
pnpm install
-
Start the application in development mode:
pnpm dev
-
Expose your local server: Use a tunneling tool like ngrok to expose your local server for Saleor.
-
Install the application via Saleor Dashboard:
[YOUR_SALEOR_DASHBOARD_URL]/apps/install?manifestUrl=[YOUR_APP_TUNNEL_MANIFEST_URL]/api/manifest
-
Build the application:
pnpm build
-
Start the production server:
pnpm start
Run unit tests:
pnpm test
Ensure .env.test
is set up for testing:
NEXT_PUBLIC_CUSTOMER_SCRAMBLE_DOMAIN=testdomain.com
-
Build the development image:
docker build -t anonymization-app-dev -f Dockerfile.dev .
-
Run the development container:
docker run -p 3000:3000 -v $(pwd):/app anonymization-app-dev
-
Build the production image:
docker build -t anonymization-app-prod -f Dockerfile.prod .
-
Run the production container:
docker run -p 3000:3000 anonymization-app-prod
.
├── src
│ ├── ScrambleAllOrdersByEmail.tsx # Main Component
├── tests
│ ├── unit
│ │ └── scramble-all-orders-by-email.test.ts # Unit Tests
├── Dockerfile.dev # Development Dockerfile
├── Dockerfile.prod # Production Dockerfile
├── .env.local # Environment Variables
├── .env.test # Test Environment Variables
├── vitest.config.ts # Vitest Configuration