A simple yet robust cashier application written in Go, providing a REST API for managing products and categories with clean architecture.
# Clone the repository
git clone git@github.com:fajar7xx/go-kasir-umam-ds.git
cd go-kasir-umam-ds
# Run the application
go run main.go
# Server runs on http://localhost:8080Complete documentation is available in the docs/ directory.
- 📖 Full Documentation Index - Start here!
- 🏗️ Architecture - System design and patterns
- 🔌 API Reference - API endpoints and examples
- 🛠️ Development Guides - How-to guides
- 🧪 Test Coverage - CI/CD & coverage config
- 📋 Implementation Plans - Feature plans and RFCs
.
├── main.go # Application entry point
├── handlers/ # HTTP handlers (presentation layer)
├── internal/
│ ├── services/ # Business logic layer
│ ├── repositories/ # Data access layer
│ ├── database/ # Database configuration
│ └── mocks/ # Test mocks
├── models/ # Data structures
├── utils/ # Utility functions
├── config/ # Configuration
├── Makefile # Build and test commands
├── .testcoverage.yml # Coverage thresholds
The project follows Clean Architecture principles:
┌─────────────┐
│ Handler │ ← HTTP Layer (handlers/)
└──────┬──────┘
│
┌──────▼──────┐
│ Service │ ← Business Logic (internal/services/)
└──────┬──────┘
│
┌──────▼──────┐
│ Repository │ ← Data Access (internal/repositories/)
└──────┬──────┘
│
┌──────▼──────┐
│ Database │ ← PostgreSQL
└─────────────┘
GET /health- Check application health
GET /api/v1/categories- Get all categoriesGET /api/v1/categories/{id}- Get category by IDPOST /api/v1/categories- Create new categoryPUT /api/v1/categories/{id}- Update categoryDELETE /api/v1/categories/{id}- Delete category
GET /api/v1/products- Get all productsGET /api/v1/products/{id}- Get product by IDPOST /api/v1/products- Create new productPUT /api/v1/products/{id}- Update productDELETE /api/v1/products/{id}- Delete product
For detailed API documentation, see docs/api/
# Run all tests
make test
# Check test coverage (for CI/CD)
make check-coverage
# Generate HTML coverage report
make coverage-html
# Show coverage summary
make coverage-report| Package | Coverage | Status |
|---|---|---|
| handlers | 83.8% | ✅ |
| services | 100% | ✅ |
| repositories | 89.6% | ✅ |
| utils | 100% | ✅ |
| Total (Business Logic) | 87.3% | ✅ |
See Test Coverage Documentation for details.
- Go 1.22 or higher
- PostgreSQL 12 or higher
- Make (optional, for using Makefile commands)
Create a .env file:
DB_HOST=localhost
DB_PORT=5432
DB_USER=your_user
DB_PASSWORD=your_password
DB_NAME=kasir_db
DB_SSLMODE=disablemake help # Show all available commands
make test # Run tests with race detector
make check-coverage # Run coverage check (CI/CD)
make coverage-html # Generate HTML coverage report
make coverage-report # Show coverage summary- Check the development guide (coming soon)
- Follow the coding standards in CLAUDE.md
- Ensure tests pass:
make check-coverage - Update documentation in
docs/as needed
This project is licensed under the MIT License - see the LICENSE file for details.
For questions or issues, please open an issue in the repository.
📚 For complete documentation, visit docs/README.md