How zerufinance/zscore-attester-prod works
Main Components
• API Gateway/Controller: Represent the entry point for client requests (the POST /task/validate endpoint within the validator.controller.ts).
• Business Logic/Service: The validator.service.ts where the core wallet validation logic (using Merkle proofs and interaction with the external API) is implemented.
• Module Structure: The validator.module.ts which wires together the controller and service – a manifestation of NestJS’s modular architecture.
• Utility Libraries: Highlight usage of OpenZeppelin’s merkle-tree library and NestJS’s class-validator for input validation, indicating their role in ensuring data integrity and secure validation.
• Logging and Error Handling: Represent the integrated NestJS Logger and error management strategy that captures API requests, validation outcomes, and errors.
• Containerization & Deployment: Note Docker-related files (Dockerfile, docker-compose.yml, .env.example, etc.) which point to containerized deployment, ensuring the whole service is production-ready and replicable.
Out Relationships and Interactions
• The “Service” interacts with:
• The Merkle proofs logic (via the OpenZeppelin library) to validate wallet score proofs.
• The “External API” component to fetch wallet data.
• Once validation is complete, the response flows back from the service to the controller and then to the client.
• A sub-component or note for “Logging & Error Handling” attached to both the Controller and Service components, emphasizing the consistent monitoring and handling of issues.
Architectural Patterns & Principles
• Separation of concerns: presentation (API endpoints), business logic (wallet validation), and integration (external API).
• Use of Docker for containerization which supports consistency across development and production environments.