{"id":15130040,"url":"https://github.com/ozgen/go-sample-rest-api","last_synced_at":"2025-10-26T13:30:57.107Z","repository":{"id":248442665,"uuid":"828603493","full_name":"ozgen/go-sample-rest-api","owner":"ozgen","description":"This is a Go-based RESTful API with Azure Blob Storage integration, utilizing Gorilla Mux for routing and providing comprehensive tools for secure and scalable web application development.","archived":false,"fork":false,"pushed_at":"2025-02-10T19:39:20.000Z","size":252,"stargazers_count":1,"open_issues_count":0,"forks_count":1,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-02-10T20:34:12.916Z","etag":null,"topics":["azure-blob","azure-blob-storage","data-migration","debugging","dependabot","docker","github-actions","go","go-rest-api","golang","k8s","logrus","mock","postgres","sql-mock","swagger-ui","swaggo","test","testify","unittest"],"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/ozgen.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":"2024-07-14T16:36:11.000Z","updated_at":"2025-02-10T19:39:23.000Z","dependencies_parsed_at":"2024-07-25T20:31:19.699Z","dependency_job_id":"1fd998c0-385c-410f-a975-c59a6768c2b3","html_url":"https://github.com/ozgen/go-sample-rest-api","commit_stats":null,"previous_names":["ozgen/go-sample-rest-api"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ozgen%2Fgo-sample-rest-api","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ozgen%2Fgo-sample-rest-api/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ozgen%2Fgo-sample-rest-api/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ozgen%2Fgo-sample-rest-api/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/ozgen","download_url":"https://codeload.github.com/ozgen/go-sample-rest-api/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":238333484,"owners_count":19454602,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","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":["azure-blob","azure-blob-storage","data-migration","debugging","dependabot","docker","github-actions","go","go-rest-api","golang","k8s","logrus","mock","postgres","sql-mock","swagger-ui","swaggo","test","testify","unittest"],"created_at":"2024-09-26T02:27:47.234Z","updated_at":"2025-10-26T13:30:57.101Z","avatar_url":"https://github.com/ozgen.png","language":"Go","readme":"\n# go-sample-rest-api\n\n## Project Overview\n\nThis repository demonstrates the implementation of a RESTful API in Go with integration to Azure Blob Storage for handling image uploads and downloads. It also includes Prometheus metrics to monitor the API performance and health. The API leverages popular Go libraries for web routing, environment management, database interactions, and more, following best practices to provide a robust backend service.\n\n## Prerequisites\n\n- **Go Version**: Requires [Go 1.23.0](https://golang.org/dl/) or higher.\n\n## Dependencies\n\nHere are the primary libraries and tools used:\n\n- **[Gorilla Mux](https://github.com/gorilla/mux)** - For HTTP routing.\n- **[godotenv](https://github.com/joho/godotenv)** - For environment variable management.\n- **[lib/pq](https://github.com/lib/pq)** - PostgreSQL driver.\n- **[Go Playground Validator](https://github.com/go-playground/validator)** - For data validation.\n- **[Go JWT](https://github.com/golang-jwt/jwt)** - For authentication.\n- **[golang-migrate](https://github.com/golang-migrate/migrate)** - For database migrations.\n- **[Azure Storage Blob Go](https://github.com/Azure/azure-storage-blob-go)** - For managing Azure Blob Storage.\n- **[Prometheus Go Client](https://github.com/prometheus/client_golang)** - For exposing custom metrics collected from the API.\n\n## Installation\n\nInstall all dependencies at once:\n\n```bash\ngo get -u github.com/gorilla/mux github.com/joho/godotenv github.com/lib/pq github.com/go-playground/validator/v10 github.com/golang-jwt/jwt/v5 github.com/DATA-DOG/go-sqlmock github.com/stretchr/testify github.com/google/uuid github.com/sirupsen/logrus github.com/Azure/azure-storage-blob-go/azblob github.com/prometheus/client_golang/prometheus github.com/prometheus/client_golang/prometheus/promhttp\n```\n\n### Database Migration Tool\n\nInstall golang-migrate on macOS using Homebrew:\n\n```bash\nbrew install golang-migrate\n```\n\n## Usage with Makefile\n\nCommon tasks can be executed using the Makefile:\n\n```bash\nmake build        # Build the application\nmake test         # Run tests\nmake run          # Run the application\nmake migration    # Create a database migration\nmake migrate-up   # Apply migrations\nmake migrate-down # Revert migrations\nmake swagger      # Generate Swagger documentation\n```\n\n## Debugging\n\nSet up Delve for sophisticated debugging:\n\n```bash\ngo install github.com/go-delve/delve/cmd/dlv@latest\nmake debug        # Start the application in debug mode\n```\n\n### API and Metrics Documentation\n\nSwagger UI is accessible at:\n[Swagger API Documentation](http://localhost:8080/api/v1/documentation/index.html)\n\nSwagger is served using `swaggo/http-swagger` integrated into the Gorilla Mux setup.\n\nPrometheus metrics are exposed at:\n[Prometheus Metrics Endpoint](http://localhost:8080/metrics)\n\nThis endpoint is used by Prometheus to collect metrics about the application's performance and health, leveraging the Prometheus Go client.\n\n## Deployment Instructions\n\nDeploy using Kubernetes and Kustomize:\n\n1. **Create Namespace**:\n    ```bash\n    kubectl create namespace ozgen\n    kubectl create namespace logging\n    kubectl create namespace monitoring\n    ```\n\n2. **Deploy Resources**:\n    ```bash\n    kustomize build k8s | kubectl apply -f -\n    ```\n\n3. **Initialize Database**:\n    ```bash\n    kustomize build k8s/ozgen/postgres | kubectl apply -f - -n ozgen\n    kubectl port-forward svc/my-postgres 5432:5432 -n ozgen\n    make migration up\n    ```\n\nCheck pod status and logs using:\n```bash\nkubectl get pods -n ozgen\nkubectl logs \u003cpod-name\u003e -n ozgen\n```\n\n---\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fozgen%2Fgo-sample-rest-api","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fozgen%2Fgo-sample-rest-api","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fozgen%2Fgo-sample-rest-api/lists"}