Go - Project Layout

Beginner 10/10 Teacher 10/10 Architect 10/10
Tip: Explore the layout used in the Sample REST API and adapt it to your service.

Standard Layout (Guideline)

app/
  cmd/api/           # main packages
  internal/          # private packages
  pkg/               # optional for shared libs
  api/               # OpenAPI/IDLs
  configs/           # configuration files

Guidelines

  • One service per cmd/<name> with a small main.
  • Keep packages cohesive; avoid circular dependencies.
  • Prefer clear boundaries; pass interfaces where helpful.