How bipbopaw/go-pet-shop works
Go Pet Shop is a Go REST API backed by PostgreSQL. Its shown runtime workflow is HTTP request → router → product or health handler → PostgreSQL storage → JSON response; configuration and logging are initialized by the server entry point. The README also describes users, orders, transactional checkout, order history and analytics, but the supplied source excerpts only implement product CRUD and health-check, so those documented capabilities are shown as unverified subsystems without asserted runtime links.
Main entry points: main.go Server Entry · products.go Product CRUD · product.go Product Storage · postgres.go PostgreSQL Pool
Components 17
HTTP API
- HTTP Router
cmd/app/main.go - Product CRUD
internal/handlers/product/products.go - Health Check
internal/handlers/status.go
Shop Domain
- Domain Models
internal/models/models.go - User Management
internal - Order Creation
internal - Transactional Checkout
internal - Order History
internal - Shop Analytics
internal
Persistence
- Product Storage
internal/storage/postgres/product.go - PostgreSQL Pool
internal/storage/postgres/postgres.go - PostgreSQL
- Database Schema
migrations
Server Runtime
- Server Entry
cmd/app/main.go - Configuration
internal/config/config.go - Logging
internal/lib/logger/logger.go
Other components
- API Client
Connections 13
- API Client → HTTP Router: sends requests
cmd/app/main.go - Server Entry → Configuration: loads settings
cmd/app/main.go - Server Entry → Logging: configures logging
cmd/app/main.go - Server Entry → PostgreSQL Pool: opens pool
cmd/app/main.go - Server Entry → HTTP Router: registers routes
cmd/app/main.go - HTTP Router → Product CRUD: routes product requests
cmd/app/main.go - HTTP Router → Health Check: routes health requests
cmd/app/main.go - Product CRUD → Product Storage: calls CRUD
internal/handlers/product/products.go - Product CRUD → Domain Models: uses products
internal/handlers/product/products.go - Product Storage → Domain Models: scans products
internal/storage/postgres/product.go - Product Storage → PostgreSQL Pool: executes queries
internal/storage/postgres/product.go - PostgreSQL Pool → PostgreSQL: connects
- Database Schema → PostgreSQL: defines schema