How ahmetb/baklava works
Below are the detailed steps and guidelines tailored for this project:
Main Components
• Cloud Run Service: The core of the application is implemented in main.go (with supporting logic in currency.go and Go modules). This service is deployed with “ko” to a Cloud Run environment.
• Provider Modules: In the providers folder, you have several directories (e.g., celebiogullari, elmacipazarigulluoglu, farukgulluoglu, etc.) each containing a provider.go file. There is also a generic parser component with its own tests. These modules likely encapsulate integrations with external data sources or APIs.
• Utility Layer: The util directory, containing files like errors.go and matching.go, provides shared helper functions and error handling across the application.
• Deployment and Scheduling: The tf directory contains Terraform configurations (main.tf and terraform.tfstate) used to deploy the scheduler (which might trigger tasks in the Cloud Run service or schedule regular operations).
Relationships and Data Flows
• The Cloud Run core (main.go) acts as the brain of the application. It likely invokes various provider modules to perform its tasks (data retrieval, processing, etc.).
• The individual provider modules interact with external systems (APIs, web pages, etc.) to get provider-specific data.
• The utility functions (errors and matching) are used by both the core service and the providers to standardize error handling and data matching.
• Terraform (in the tf folder) manages the deployment and scheduling aspects of the system, ensuring that the Cloud Run service is kept up-to-date and that periodic tasks are triggered as necessary.
Architectural Patterns and Design Principles
• Modularity: The separation of provider logic into different subdirectories shows a modular design. Each provider encapsulates its own integration logic, making it easier to extend or modify.
• Separation of Concerns: The core business logic (main.go, currency.go) is kept separate from integration concerns (providers) and utility functions.
• Infrastructure as Code: The tf directory signifies the use of Terraform for managing deployment configurations, ensuring reproducibility and consistent environment setups.