How alexsantosfilho/hubspot_integration works
Project Type and Purpose
• The project is a backend integration API built using Spring Boot.
• Its primary purpose is to integrate with HubSpot: managing OAuth 2.0 authentication, contact creation, processing of webhook events, and serving an interactive API documentation with Swagger.
• Key functionalities include handling authentication redirection, exchanging authorization codes, and performing business logic for contact management and webhook processing.
File Structure
• The top-level structure includes Maven configuration files (pom.xml, mvnw, etc.) and a well-organized src directory.
• Under src/main/java, the package structure “com.hubspot.integration” indicates a layered architecture:
• Application Entry: IntegrationApplication.java serves as the Spring Boot starting point.
• Configurations: The “config” package (RestTemplateConfig.java, SecurityConfig.java) defines settings for REST communications and security (e.g., OAuth flow and webhook signature validation).
• Controllers: The “controller” package is split into “api” (for endpoints such as ContactController and OAuthController) and “webhook” (for handling HubSpot webhook callbacks).
• DTOs: The “dto” package categorizes data transfer objects for contacts, OAuth, and webhooks – encapsulating the payload structures.
• Services: The “service” package is split into subpackages for contact, OAuth, and webhook processing. These services contain the business logic and integrate with HubSpot’s external endpoints via RestTemplate.
• Exceptions: Centralized error handling via GlobalExceptionHandler along with OAuthException.
• The structure supports a clean separation between controllers, services, configuration, and error handling.
Architectural Insights from the README
• The README specifies that the API handles OAuth authentication, contact management, and webhook processing.
• It lists out technical decisions like layered architecture (controllers → services → external HubSpot API via RestTemplate), use of DTOs, centralized exception handling, and integration with Swagger (OpenAPI documentation).
• It also mentions external dependencies (HubSpot endpoints, external OAuth flows) and core Spring Boot features (security, validation, REST, etc.).