A robust backend system for managing coffee shop operations, built with pure Go and focusing on clean architecture principles.
Hot-Coffee is a REST API-based management system that handles:
- Order processing and tracking
- Inventory management
- Menu item administration
- Sales reporting and analytics
- Pure Go Implementation: Built using only Go standard library, demonstrating deep language expertise
- Three-Layer Architecture:
- Presentation Layer (Handlers)
- Business Logic Layer (Services)
- Data Access Layer (Repositories)
- Optimized Performance: Implemented O(1) removal operations
- Persistent Storage: Custom JSON-based data management system
- Comprehensive Logging: Integrated slog package for system monitoring
- RESTful API endpoints for orders, menu items, and inventory management
- Real-time inventory tracking and updates
- Automated ingredient deduction upon order processing
- Sales and popularity reporting
- Structured error handling with appropriate HTTP status codes
.
├── cmd
│ └── main.go
├── go.mod
├── internal
│ ├── core
│ │ ├── consts.go
│ │ ├── flag.go
│ │ └── slog.go
│ ├── handler
│ │ ├── handler.go
│ │ ├── inventory.go
│ │ ├── menu.go
│ │ ├── order.go
│ │ ├── report.go
│ │ └── routes.go
│ ├── repository
│ │ ├── inventory.go
│ │ ├── json_store.go
│ │ ├── menu.go
│ │ ├── order.go
│ │ └── report.go
│ └── service
│ ├── inventory.go
│ ├── menu.go
│ ├── order.go
│ └── report.go
├── main.go
├── Makefile
├── models
│ ├── inventory.go
│ ├── menu.go
│ ├── order.go
│ └── report.go
└── README.md
POST /orders
- Create new orderGET /orders
- Retrieve all ordersGET /orders/{id}
- Retrieve specific orderPUT /orders/{id}
- Update orderDELETE /orders/{id}
- Delete orderPOST /orders/{id}/close
- Close order
POST /menu
- Add menu itemGET /menu
- Retrieve all menu itemsGET /menu/{id}
- Retrieve specific menu itemPUT /menu/{id}
- Update menu itemDELETE /menu/{id}
- Delete menu item
POST /inventory
- Add inventory itemGET /inventory
- Retrieve all inventory itemsGET /inventory/{id}
- Retrieve specific inventory itemPUT /inventory/{id}
- Update inventory itemDELETE /inventory/{id}
- Delete inventory item
GET /reports/total-sales
- Get total salesGET /reports/popular-items
- Get popular items
- Data Persistence: Custom JSON file-based storage system
- Error Handling: Comprehensive error handling with appropriate HTTP status codes
- Logging: Structured logging using Go's slog package
- Performance: Optimized data operations with O(1) complexity for removals
./hot-coffee [--port <N>] [--dir <S>]
./hot-coffee --help
Options:
--port N
: Specify port number--dir S
: Set data directory path--help
: Show help information
- Implemented without external dependencies
- Structured for maintainability and scalability
- Robust error handling and logging system