Go project structure and package layout #6

Open
opened 2026-08-23 11:17:16 +02:00 by gaetan · 0 comments
Owner

Part of #1

Question

Design the Go project structure following Clean Architecture principles. Key decisions:

  • Package layout: How to organize the codebase — by layer (handler/service/repository) or by domain (book/user/auth)?
  • Dependency injection: How to wire dependencies — manual wiring in main.go or a DI container?
  • Configuration: How to load config (env vars, .env file, config file)?
  • Error handling: Global error types? Custom error wrapping?
  • Testing strategy: Table-driven tests? Mock interfaces? Testcontainers for SQLite?

Consider the Clean Architecture convention from CLAUDE.md: entities → use cases → interface adapters → frameworks.

Example structure to evaluate:

cmd/
  server/
    main.go
internal/
  domain/
    book.go
    user.go
  usecase/
    book_usecase.go
  adapter/
    http/
      book_handler.go
    repository/
      book_repo.go
  config/
    config.go
Part of #1 ## Question Design the Go project structure following Clean Architecture principles. Key decisions: - **Package layout**: How to organize the codebase — by layer (handler/service/repository) or by domain (book/user/auth)? - **Dependency injection**: How to wire dependencies — manual wiring in `main.go` or a DI container? - **Configuration**: How to load config (env vars, .env file, config file)? - **Error handling**: Global error types? Custom error wrapping? - **Testing strategy**: Table-driven tests? Mock interfaces? Testcontainers for SQLite? Consider the Clean Architecture convention from CLAUDE.md: entities → use cases → interface adapters → frameworks. Example structure to evaluate: ``` cmd/ server/ main.go internal/ domain/ book.go user.go usecase/ book_usecase.go adapter/ http/ book_handler.go repository/ book_repo.go config/ config.go ```
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Depends on
Reference
gaetan/Argus#6
No description provided.