How sanjay-05/book_management_system works
This is a Gin-based Book Store API. Its principal workflow is an HTTP request routed through public or role-protected routes to a handler, then through business services to repository operations backed by PostgreSQL; handlers return API responses. The domain spans identity and password recovery, catalog and contact administration, user profiles, carts, and order checkout/status. The source excerpts show representative calls across these layers, but not every route or subsystem implementation; README-documented capabilities are retained without inventing their internal wiring.
Main entry points: routes.go HTTP routes · dbConnection.go Database connection · main.go Server startup · user_handler.go Identity handlers
Components 19
Server runtime
- Server startup
main.go - Configuration
config/config.go - HTTP routes
router/routes.go
Identity and access
- Role middleware
middleware/auth.go - Auth helpers
helper/helper.go - Identity handlers
handler/user_handler.go - Identity services
service/user_service.go
Catalog administration
- Admin handlers
handler/admin_handler.go - Admin services
service/admin_service.go
User commerce
- Cart and order handlers
handler/userAdmin_handler.go - Cart and order services
service/userAdmin_service.go
Persistence
- User repository
repository/user_repository.go - Cart and order repository
repository/userAdmin_repository.go - Admin repository
repository/admin_repository.go - Domain models
models/models.go - Database connection
driver/dbConnection.go - Database migrations
migrations
Other components
- API client
- PostgreSQL
Connections 24
- API client → HTTP routes: sends requests
README.md - Server startup → Configuration: loads settings
main.go - Server startup → Database connection: connects database
main.go - Server startup → HTTP routes: starts server
main.go - HTTP routes → Role middleware: protects routes
router/routes.go - HTTP routes → Identity handlers: routes requests
router/routes.go - HTTP routes → Cart and order handlers: routes requests
router/routes.go - HTTP routes → Admin handlers: routes requests
router/routes.go - Role middleware → Auth helpers: validates tokens
middleware/auth.go - Identity handlers → Auth helpers: hashes passwords
handler/user_handler.go - Identity handlers → Identity services: delegates identity
handler/user_handler.go - Identity services → User repository: checks and updates users
service/user_service.go - Cart and order handlers → Cart and order services: delegates commerce
handler/userAdmin_handler.go - Cart and order services → Cart and order repository: performs commerce operations
service/userAdmin_service.go - Admin handlers → Admin services: delegates administration
handler/admin_handler.go - Admin services → Admin repository: manages catalog and users
service/admin_service.go - Admin services → User repository: checks user records
service/admin_service.go - User repository → Database connection: uses database handle
repository/user_repository.go - Cart and order repository → Database connection: uses database handle
repository/userAdmin_repository.go - Admin repository → Database connection: uses database handle
repository/admin_repository.go - Database connection → PostgreSQL: connects to
README.md - Database migrations → PostgreSQL: defines schema
- Cart and order repository → Domain models: queries domain records
repository/userAdmin_repository.go - Admin repository → Domain models: queries domain records
repository/admin_repository.go