Understand the Goca project structure
masterGoca follows Clean Architecture principles, organizing code into layers to ensure a clear separation of concerns. The project is divided into cmd/ for entry points, internal/ for private application logic, pkg/ for public libraries, and migrations/ for database changes.
Directory Overview
cmd/: Application entry points (e.g.,cmd/server/main.go).internal/: Private application code containing the core layers:domain/: Business entities and core rules.usecase/: Business logic and application rules.repository/: Data access implementations.handler/: Delivery mechanisms (e.g., HTTP).di/: Dependency injection wiring.messages/: Errors and constants.
pkg/: Public libraries that can be imported by other projects (e.g.,config/,logger/).migrations/: SQL database migration files.
myproject/
├── cmd/ # Application entry points
│ └── server/
│ └── main.go
├── internal/ # Private application code
│ ├── domain/ # Business entities
│ ├── usecase/ # Business logic
│ ├── repository/ # Data access
│ ├── handler/ # Delivery mechanisms
│ ├── di/ # Dependency injection
│ └── messages/ # Errors and constants
├── pkg/ # Public libraries
│ ├── config/ # Configuration loading
│ └── logger/ # Structured logging
├── migrations/ # Database migrations