How septblast/aws-resources-cost-board works
Main Components
• Frontend: Represented by the React application. This part contains the UI components (in the “components” directory) and a service layer (“services/api.js”) that communicates with the backend.
• Backend API: Constructed in Go, which is split into several modules:
• API Handlers: Contained under “backend/api” (and “backend/internal/api”) where the endpoints and request handling logic reside.
• AWS Integration Layer: Located in “backend/aws” (and similarly under “backend/internal/aws”). This houses service clients and functions to interact with various AWS APIs (EC2, RDS, Cost Explorer, CloudWatch, etc.).
• Models: Both “backend/models” and “backend/internal/models” represent the data structures used across the application.
• Services: “backend/internal/services” for business logic like resource cost calculation and aggregation.
• Configuration: “backend/internal/config” manages application settings and environment variables.
• EC2 for instance data.
• RDS for database instance information.
• Cost Explorer (and CloudWatch for monitoring capabilities) for getting cost and usage reports.
Relationships and Interactions
• Client-to-Server Communication: The React frontend sends HTTP requests (likely RESTful API calls) to the Go backend.
• API Layer: In the backend, API endpoints (in “api/server.go”, “cmd/server/main.go”) process incoming requests, call the service layer, and respond with JSON data.
• AWS Integration: The backend service calls functions in the AWS integration modules (i.e. “aws/client.go”, “aws/ec2.go”, “aws/rds.go”, “aws/cost.go”, “aws/cloudwatch.go”) to fetch resource and cost data from AWS.
• Data Flow: Once AWS data is retrieved, the data is processed (using models and services) and returned to the frontend for visualization.
Architectural Patterns and Design Principles
• Layered Architecture: The separation between routines that handle HTTP requests (API handlers), business logic (internal services), and external integrations (AWS adapters) is clear.
• Separation of Concerns: Splitting the application into distinct directories (api, aws, models, config, etc.) reflects modular design.
• Client-Server Model: A clear delineation between the frontend (user interface) and backend (logic and integration) is evident.
• Extensibility: The structure (with separation between external service operations and internal application logic) makes it easy to extend functionality (e.g., adding new AWS service integrations).
Technologies and Frameworks
• Frontend: Built with React (JavaScript/JSX) using components and service calls to interact with the backend.
• Backend: Built with Go. It uses Go modules (go.mod, go.sum) for dependency management.
• AWS SDK Usage: The backend includes AWS client functionality to query various AWS services, emphasizing the project’s integration with AWS.