{"id":21630126,"url":"https://github.com/prutya/go-api-template","last_synced_at":"2026-04-19T03:31:35.696Z","repository":{"id":264191746,"uuid":"858552126","full_name":"prutya/go-api-template","owner":"prutya","description":"An opinionated DIY template for Golang JSON API applications","archived":false,"fork":false,"pushed_at":"2025-11-23T20:20:40.000Z","size":12791,"stargazers_count":1,"open_issues_count":1,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-11-23T21:18:32.106Z","etag":null,"topics":["api","golang","web"],"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/prutya.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,"zenodo":null,"notice":null,"maintainers":null,"copyright":null,"agents":null,"dco":null,"cla":null}},"created_at":"2024-09-17T05:22:05.000Z","updated_at":"2025-11-23T20:20:44.000Z","dependencies_parsed_at":null,"dependency_job_id":"d6c75b43-758e-4116-ba70-40240b3182cb","html_url":"https://github.com/prutya/go-api-template","commit_stats":null,"previous_names":["prutya/go-api-template"],"tags_count":0,"template":true,"template_full_name":null,"purl":"pkg:github/prutya/go-api-template","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/prutya%2Fgo-api-template","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/prutya%2Fgo-api-template/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/prutya%2Fgo-api-template/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/prutya%2Fgo-api-template/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/prutya","download_url":"https://codeload.github.com/prutya/go-api-template/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/prutya%2Fgo-api-template/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":31993687,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-04-18T20:23:30.271Z","status":"online","status_checked_at":"2026-04-19T02:00:07.110Z","response_time":55,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"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","golang","web"],"created_at":"2024-11-25T02:09:50.842Z","updated_at":"2026-04-19T03:31:35.688Z","avatar_url":"https://github.com/prutya.png","language":"Go","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Go API app Template\n\nAn opinionated DIY template for Golang JSON API applications\n\n![Build status](https://github.com/prutya/go-api-template/actions/workflows/main.yml/badge.svg)\n\n## What's in the box?\n\n### App\n- [x] Router ([chi](https://github.com/go-chi/chi))\n- [x] Real IP middleware ([chi](https://pkg.go.dev/github.com/go-chi/chi/middleware#RealIP))\n- [x] Request ID middleware\n- [x] Error recovery middleware\n- [x] CORS middleware ([chi](https://github.com/go-chi/cors))\n- [x] Compatibility with standard library (net/http) middleware\n- [x] Error handling\n- [x] Secure Configurable Authentication (based on Refresh Tokens)\n- [x] Transactional Emails via [Scaleway](https://www.scaleway.com/)\n- [x] CAPTCHA via [Cloudflare Turnstile](https://www.cloudflare.com/application-services/products/turnstile/)\n\n### Database\n- [x] ORM ([bun](https://github.com/uptrace/bun))\n- [x] Language-agnostic database migration toolkit ([dbmate](https://github.com/amacneil/dbmate))\n\n### Background jobs processing\n- [x] Background jobs processing setup via [Asynq](https://github.com/hibiken/asynq)\n\n### Quality control\n- [x] Testing setup ([ginkgo](https://github.com/onsi/ginkgo))\n- [x] Github Actions Test job\n- [x] Github Actions Lint job ([golangci-lint](https://github.com/golangci/golangci-lint))\n\n### Misc\n- [x] Structured logger ([slog](https://go.dev/blog/slog))\n- [x] Configuration ([viper](https://github.com/spf13/viper))\n\n### Development and deployment\n- [x] Docker Compose setup for development\n- [x] Multi-stage Dockerfile\n- [x] Hot-reload via [Air](https://github.com/air-verse/air)\n\n## Prerequisites\n\n- [Install Go](https://go.dev/doc/install)\n- [Install Docker](https://docs.docker.com/get-started/)\n\n## Running the app locally\n\n### 1. Install developer tools\n```sh\n./setup-dev.sh\n```\n\n### 2. Install packages\n\n```sh\ngo mod download\n```\n\n### 3. Start database and Redis servers\n\n```sh\ndocker compose up postgres redis\n```\n\n### 4. Run database migrations\n\nThe second part of the command is a workaround until `dbmate` image supports\npostgres version 18\n\n```sh\ndocker compose run --rm dbmate migrate \u0026\u0026 docker compose run --rm dump_schema\n```\n\n### 5. Seed the database\n\n```sh\ndocker compose run --rm psql --echo-all --file /db/seed.sql\n```\n\n### 6. Start the app\n\n```sh\nair -c ./.air.server.toml\n\n# Or (without hot reload)\ngo run -tags=debug cmd/server/main.go\n```\n\n### Recreating the database\n```sh\n# Drop the database\ndocker compose run --rm dbmate drop\n\n# Create the database and run migrations\ndocker compose run --rm dbmate up\n```\n\n## Running the background jobs processor locally\n\n### 1. Set up the database\nMake sure that steps 1-4 from **Running the app locally** are completed\n\n### 2. Start the worker\n```sh\nair -c ./.air.worker.toml\n\n# Or (without hot reload)\ngo run -tags=debug cmd/worker/main.go\n```\n\n## Running the background jobs scheduler (CRON-like) locally\n\n### 1. Set up the database\nMake sure that steps 1-4 from **Running the app locally** are completed\n\n### 2. Start the scheduler\n```sh\nair -c ./.air.scheduler.toml\n\n# Or (without hot reload)\ngo run -tags=debug cmd/scheduler/main.go\n```\n\n## Running tests\n\n```sh\ndocker compose run --build --rm test\n```\n\n## Running the linter\n```sh\ndocker compose run --build --rm lint\n```\n\n## Building the production image\n\nServer, worker and scheduler binaries will be in the same image\n\n```sh\ndocker build . --tag go-api-template:latest\n```\n\n## Enabling linters in IDE\nhttps://golangci-lint.run/docs/welcome/integrations/\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fprutya%2Fgo-api-template","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fprutya%2Fgo-api-template","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fprutya%2Fgo-api-template/lists"}