Documentation

Project Structure

Organize routes, middleware, services, and adapters.

Overview

Use a package layout that keeps handlers thin and business logic isolated.

Example

Go

internal/
  api/
  service/
  store/
cmd/server/main.go

Best Practices

  • Keep transport concerns in API packages.
  • Isolate persistence behind interfaces.

Common Pitfalls

  • Mixing DB logic directly in handlers.
  • Creating oversized packages with unclear ownership.