How ankitnayan83/house-bank works
Main Components
• API Service: Represent the files in the “api” directory (account.go, server.go, etc.) as the core service that handles HTTP requests and business logic.
• Database: Include a component for the database. This is illustrated by the “db” directory where you have migration SQL files (under db/migration) and the SQL queries along with auto-generated Go code (under db/sqlc).
• Data Access Layer: Highlight the SQLC-generated code as the translation layer between raw SQL and Go. This shows how queries (SQLC package, query and store components) are used by the API service.
• Utility/Configuration Layer: Represent the “util” package (config.go and random.go) to emphasize how configuration and helper routines are integrated into the system.
• CI/CD Pipeline: Since there is a .github/workflows directory with a cicd.yml, include a deployment/continuous integration component as well.
Relationships/Interactions
• Detail that the API interacts with the Data Access Layer (SQLC-generated code) which abstracts away raw SQL calls.
• Optionally, link the CI/CD component to both the application code and database migration processes, reflecting automated testing and deployment.
Architectural Patterns and Principles
• Separation of concerns: Highlight that the API layer (business logic and endpoint handling) is separate from the data access layer (SQLC-generated code and migration management).
• Code Generation: Emphasize the use of SQLC for generating strongly typed database access code, a key design decision that simplifies query interactions.
• Testing: Note the inclusion of test files (e.g., account_test.go, main_test.go) which underscores an emphasis on verifying each component separately.
Relevant Technologies
• Go as the language (evidenced by go.mod, go.sum, and .go files).
• SQL migrations (likely for PostgreSQL or MySQL) managed via explicit up/down SQL scripts.
• SQLC for code-generation and type safe database operations.
• GitHub Actions for CI/CD as seen in the .github/workflows/cicd.yml file.
• Utility configuration for environment settings (util/config.go).
Instructing the Principal Software Engineer
• Blue for application code (API Service, utilities)
• Green for the database and its layers (SQLC, migration)
• Orange for operational components (CI/CD)