Planning the Go Backend for a Pantry Tracker: Structure and API Design

The author has finished designing the database and now plans the Go backend before writing any code. They note they know some Go but have never built a project following idiomatic Go conventions. Go has no official project layout, so the author adopts two common conventions: a cmd/ folder for runnable programs and an internal/ folder for the rest of the code. They prefer organising internal code by feature rather than by layer, which keeps related logic in one place and reads well with Go's package naming. The resulting structure separates product, pantry, and category features alongside shared folders such as auth, database, config, and httpjson. They also explain that shared code goes in its own small folder to avoid Go's import cycles.
This is an AI-generated summary. ShortSingh links to the original source for the complete article.

Discussion (0)
Log in to join the discussion and vote.
Log in