{"id":26574186,"url":"https://github.com/aashari/example-go-tax-calculator-api","last_synced_at":"2026-05-03T21:35:09.121Z","repository":{"id":95958748,"uuid":"167796415","full_name":"aashari/example-go-tax-calculator-api","owner":"aashari","description":"RESTful API example in Go for tax calculations. Showcases clean architecture, middleware usage, validation, testing, Swagger docs, containerization, and performance optimization techniques in a production-ready API structure.","archived":false,"fork":false,"pushed_at":"2025-03-21T16:42:58.000Z","size":13,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-07-11T07:26:29.483Z","etag":null,"topics":["api-design","docker","golang","microservice","rest-api","tax-calculator","testing","web-service"],"latest_commit_sha":null,"homepage":"","language":"Go","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/aashari.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2019-01-27T10:31:02.000Z","updated_at":"2025-03-21T17:02:47.000Z","dependencies_parsed_at":null,"dependency_job_id":"6cdff722-a8c7-45f7-be46-2f39e17c444b","html_url":"https://github.com/aashari/example-go-tax-calculator-api","commit_stats":null,"previous_names":["aashari/restapi-go-tax-calculator"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/aashari/example-go-tax-calculator-api","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/aashari%2Fexample-go-tax-calculator-api","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/aashari%2Fexample-go-tax-calculator-api/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/aashari%2Fexample-go-tax-calculator-api/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/aashari%2Fexample-go-tax-calculator-api/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/aashari","download_url":"https://codeload.github.com/aashari/example-go-tax-calculator-api/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/aashari%2Fexample-go-tax-calculator-api/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":32586187,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-05-03T06:36:36.687Z","status":"ssl_error","status_checked_at":"2026-05-03T06:36:09.306Z","response_time":103,"last_error":"SSL_read: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["api-design","docker","golang","microservice","rest-api","tax-calculator","testing","web-service"],"created_at":"2025-03-23T01:38:11.215Z","updated_at":"2026-05-03T21:35:09.105Z","avatar_url":"https://github.com/aashari.png","language":"Go","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Tax Calculator API\n\nA Go-based REST API service for calculating taxes on various product types based on their tax codes.\n\n## Features\n\n- Fast tax calculation for individual products or in bulk\n- Support for different tax types (Food and Beverage, Tobacco, Entertainment)\n- Configurable tax rules (percentages and fixed amounts)\n- Support for refundable vs. non-refundable taxes\n- API endpoints for both single and bulk calculation\n\n## Prerequisites\n\n- Docker and Docker Compose\n\n## How to Run\n\nTo run this project, use the following command:\n\n```bash\ndocker-compose up --build\n```\n\nThis will build and start:\n\n- MySQL database container\n- Golang application container\n\nThe setup process will:\n\n1. Download all Go dependencies\n2. Run database schema migration\n3. Seed the database with default tax configurations\n\nWhen the service is ready, you should see output similar to:\n\n```bash\ngolang_service    | [GIN-debug] POST   /v1/taxes                 --\u003e _/my_app/controllers.(*V1TaxesController).CalculateTax-fm (4 handlers)\ngolang_service    | [GIN-debug] POST   /v1/taxes/bulk            --\u003e _/my_app/controllers.(*V1TaxesController).CalculateTaxBulk-fm (4 handlers)\ngolang_service    | 0.0.0.0:3000\ngolang_service    | [GIN-debug] Listening and serving HTTP on 0.0.0.0:3000\n```\n\nThe API will be available at: http://localhost:3000\n\n## API Endpoints\n\n### Calculate Tax for Single Item\n\n**Endpoint:** `POST /v1/taxes`\n\n**Request Body:**\n\n```json\n{\n  \"name\": \"Product Name\",\n  \"tax_code\": 1,\n  \"price\": 100.0\n}\n```\n\n**Response:**\n\n```json\n{\n  \"name\": \"Product Name\",\n  \"tax_code\": 1,\n  \"type\": \"Food and Beverage\",\n  \"refundable\": \"YES\",\n  \"price\": 100.0,\n  \"tax\": 10.0,\n  \"amount\": 110.0\n}\n```\n\n### Calculate Tax for Multiple Items\n\n**Endpoint:** `POST /v1/taxes/bulk`\n\n**Request Body:**\n\n```json\n[\n  {\n    \"name\": \"Product 1\",\n    \"tax_code\": 1,\n    \"price\": 100.0\n  },\n  {\n    \"name\": \"Product 2\",\n    \"tax_code\": 2,\n    \"price\": 200.0\n  }\n]\n```\n\n**Response:** Array of tax calculation results for each item.\n\n## Tax Codes\n\n| Tax Code | Description       | Refundable |\n| -------- | ----------------- | ---------- |\n| 1        | Food and Beverage | Yes        |\n| 2        | Tobacco           | No         |\n| 3        | Entertainment     | No         |\n\n## Project Structure\n\n```\nsrc/\n├── controllers/        # API request handlers\n├── services/           # Business logic\n├── repositories/       # Database interaction\n├── models/             # Data models\n├── objects/            # Request/response objects\n├── database/           # Database connection and migrations\n├── middleware/         # HTTP middleware\n├── helpers/            # Utility functions\n├── constants/          # Constant values\n└── main.go             # Application entry point\n```\n\n## Detailed API Documentation\n\nFor comprehensive API documentation, see:\n[Postman Documentation](https://documenter.getpostman.com/view/883805/RztitAQK)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Faashari%2Fexample-go-tax-calculator-api","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Faashari%2Fexample-go-tax-calculator-api","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Faashari%2Fexample-go-tax-calculator-api/lists"}