📧 Email JSON Extractor 🔍
🎥 Quick Video Demo
Check out this short video rundown of the project: Email JSON Extractor Demo
🚀 Features
- 📎 Extract JSON from email attachments
- 🔗 Parse JSON from links in email body
- 🌐 Fetch and parse JSON from webpage links found in emails
- 🛡️ Robust error handling and logging
🏗️ Architecture
This project uses a hexagonal architecture (also known as ports and adapters) to separate concerns and improve maintainability. The architecture is divided into three main layers:
- Domain 🧠: Contains business logic and entities
- Application 🖥️: Houses use cases and DTOs
- Infrastructure 🏗️: Implements adapters for external services and repositories
🤔 Why Hexagonal Architecture?
- Separation of concerns 🧩: Business logic is isolated from external dependencies.
- Testability 🧪: Core business logic can be tested without external dependencies.
- Flexibility 🤸: Easy to swap out external implementations.
- Maintainability 🔧: Changes in one layer don’t affect others.
🔗 Relation to Microservices
While this project is a monolithic application, its hexagonal architecture makes it well-suited for potential migration to a microservices architecture:
- Clear boundaries 🧱: Easy extraction of functionalities into separate services.
- Dependency inversion 🔄: Use of interfaces (ports) for easy adaptation across services.
- Scalability 📈: Individual components can be scaled independently.
🚀 Running the Application
To start the application in development mode:
- yarn install
- yarn start:dev
🧪 Testing
To run the tests:
- yarn test:e2e
- yarn jest
📚 API Documentation
Parse Email Endpoint
- GET
/email-parser/parse
- Query Parameters:
path
: The path to the email file to be parsed.
- Example Request:
GET /email-parser/parse?path=test/test_attachment.eml
- Example Response:
{ "jsonContent": { "name": "John Doe", "age": 30, "city": "New York" } }
🙏 Acknowledgments
Special thanks to the NestJS community for their support and resources. You rock! 🎸
Stay tuned for more updates and features! 🚀