{"id":16735785,"url":"https://github.com/mrz1836/go-api","last_synced_at":"2025-03-21T21:31:37.506Z","repository":{"id":36018193,"uuid":"202910344","full_name":"mrz1836/go-api","owner":"mrz1836","description":":rocket: Example api for inspiration on your new projects","archived":false,"fork":false,"pushed_at":"2024-04-29T10:37:12.000Z","size":3189,"stargazers_count":9,"open_issues_count":0,"forks_count":2,"subscribers_count":4,"default_branch":"master","last_synced_at":"2024-05-01T15:38:35.362Z","etag":null,"topics":["api","api-server","caching","go","golang","gomodule","logging","redis","router","sqlboiler"],"latest_commit_sha":null,"homepage":"","language":"Go","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/mrz1836.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":".github/CONTRIBUTING.md","funding":".github/FUNDING.yml","license":"LICENSE","code_of_conduct":".github/CODE_OF_CONDUCT.md","threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":".github/SECURITY.md","support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null},"funding":{"github":"mrz1836","custom":"https://mrz1818.com/?tab=tips\u0026af=go-api"}},"created_at":"2019-08-17T17:10:48.000Z","updated_at":"2024-05-06T04:29:16.725Z","dependencies_parsed_at":"2023-02-12T22:15:57.180Z","dependency_job_id":"3211626c-bba2-42c2-b2bb-3a9ea3a8e412","html_url":"https://github.com/mrz1836/go-api","commit_stats":null,"previous_names":[],"tags_count":19,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mrz1836%2Fgo-api","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mrz1836%2Fgo-api/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mrz1836%2Fgo-api/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mrz1836%2Fgo-api/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/mrz1836","download_url":"https://codeload.github.com/mrz1836/go-api/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":244164459,"owners_count":20408937,"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":["api","api-server","caching","go","golang","gomodule","logging","redis","router","sqlboiler"],"created_at":"2024-10-13T00:07:18.338Z","updated_at":"2025-03-21T21:31:37.070Z","avatar_url":"https://github.com/mrz1836.png","language":"Go","readme":"# go-api\n\u003e Example API with support for common implementations\n\n[![Release](https://img.shields.io/github/release-pre/mrz1836/go-api.svg?logo=github\u0026style=flat\u0026v=1)](https://github.com/mrz1836/go-api/releases)\n[![Build Status](https://img.shields.io/github/actions/workflow/status/mrz1836/go-api/run-tests.yml?branch=master\u0026logo=github\u0026v=3)](https://github.com/mrz1836/go-api/actions)\n[![Report](https://goreportcard.com/badge/github.com/mrz1836/go-api?style=flat\u0026v=1)](https://goreportcard.com/report/github.com/mrz1836/go-api)\n[![Go](https://img.shields.io/github/go-mod/go-version/mrz1836/go-api)](https://golang.org/)\n[![Sponsor](https://img.shields.io/badge/sponsor-MrZ-181717.svg?logo=github\u0026style=flat\u0026v=3)](https://github.com/sponsors/mrz1836)\n[![Donate](https://img.shields.io/badge/donate-bitcoin-ff9900.svg?logo=bitcoin\u0026style=flat)](https://mrz1818.com/?tab=tips\u0026af=go-api)\n\n\u003cbr/\u003e\n\n## Table of Contents\n- [Installation](#installation)\n- [Documentation](#documentation)\n- [Examples \u0026 Tests](#examples--tests)\n- [Benchmarks](#benchmarks)\n- [Code Standards](#code-standards)\n- [Usage](#usage)\n- [Maintainers](#maintainers)\n- [Contributing](#contributing)\n- [License](#license)\n\n\u003cbr/\u003e\n\n## Installation\n\n**1)** **go-api** requires [Go](https://golang.org/doc/devel/release.html#policy), [Redis](https://redis.io/) and [MySQL](https://www.mysql.com/) with no password set \n```shell script\ngo get -u github.com/mrz1836/go-api\nmake install\n```\n\n**2)** Run the API\n```shell script\nmake run\n\n  \"starting Go API server...\"\n```\n\n_Test your connection to the api_\n```shell script\ncurl -X GET 'http://localhost:3000'\n\n  \"Welcome to the Go API!\"\n```\n\n\u003cbr/\u003e\n\n## Documentation\nView the generated [documentation](https://pkg.go.dev/github.com/mrz1836/go-api)\n\n[![GoDoc](https://godoc.org/github.com/mrz1836/go-api?status.svg\u0026style=flat)](https://pkg.go.dev/github.com/mrz1836/go-api)\n\n### Features\n- Combination of powerful Go packages all-in-one API solution\n- The fastest router: Julien Schmidt's [httprouter](https://github.com/julienschmidt/httprouter)\n- The best redis cache package: Gary Burd's [Redigo](https://github.com/gomodule/redigo)\n- Powerful database ORM: VolatileTech's [SQLBoiler](https://github.com/volatiletech/sqlboiler)\n- Database migration: Pressly's [Goose](https://github.com/pressly/goose)\n- Ready for development or production use\n- Cache dependency management via [go-cache](https://github.com/mrz1836/go-cache)\n- Supports different incoming load balancer setups (/health)\n- Logging each request and whenever you need logs (remote via [LogEntries](https://logentries.com/))\n- Flexible environment \u0026 configuration management using [viper](https://github.com/spf13/viper)\n- Built-in scheduler for any cron jobs or delayed tasks\n- Powerful and easy emailing with support for [Postmark](https://postmarkapp.com), [Mandrill](https://mandrillapp.com), [AWS SES](https://aws.amazon.com/ses/) and [SMTP](https://en.wikipedia.org/wiki/Simple_Mail_Transfer_Protocol)\n\n\u003cdetails\u003e\n\u003csummary\u003e\u003cstrong\u003e\u003ccode\u003ePackage Dependencies\u003c/code\u003e\u003c/strong\u003e\u003c/summary\u003e\n\u003cbr/\u003e\n\n- [cron](https://github.com/robfig/cron/v3) - Run cron jobs with ease\n- [go-api-router](https://github.com/mrz1836/go-api-router) - Fast and lightweight router\n- [go-cache](https://github.com/mrz1836/go-cache) - Redis caching made easy\n- [go-logger](https://github.com/mrz1836/go-logger) - Local or remote logging\n- [go-mail](https://github.com/mrz1836/go-mail) - Email using multiple providers\n- [go-sanitize](https://github.com/mrz1836/go-sanitize) - Clean data effortlessly\n- [goose](https://github.com/pressly/goose) - Database migration\n- [ozzo-validation](https://github.com/go-ozzo/ozzo-validation) - Extensible data validation\n- [SQLBoiler](https://github.com/volatiletech/sqlboiler) - Powerful database ORM \u0026 model generation\n- [viper](https://github.com/spf13/viper) - Go configuration with fangs\n\u003c/details\u003e\n\n\u003cdetails\u003e\n\u003csummary\u003e\u003cstrong\u003e\u003ccode\u003eLibrary Deployment\u003c/code\u003e\u003c/strong\u003e\u003c/summary\u003e\n\u003cbr/\u003e\n\n[goreleaser](https://github.com/goreleaser/goreleaser) for easy binary or library deployment to GitHub and can be installed via: `brew install goreleaser`.\n\nThe [.goreleaser.yml](.goreleaser.yml) file is used to configure [goreleaser](https://github.com/goreleaser/goreleaser).\n\nUse `make release-snap` to create a snapshot version of the release, and finally `make release` to ship to production.\n\u003c/details\u003e\n\n\u003cdetails\u003e\n\u003csummary\u003e\u003cstrong\u003e\u003ccode\u003eMakefile Commands\u003c/code\u003e\u003c/strong\u003e\u003c/summary\u003e\n\u003cbr/\u003e\n\nView all `makefile` commands\n```shell script\nmake help\n```\n\nList of all current commands:\n```text\nall                  Runs multiple commands\nclean                Remove previous builds and any test cache data\nclean-mods           Remove all the Go mod cache\ncoverage             Shows the test coverage\ndb                   Creates a fresh database\ndiff                 Show the git diff\nenv                  Creates a fresh database\nflush-redis          Wipe out all data in redis (requires redli)\ngenerate             Runs the go generate command in the base of the repo\ngodocs               Sync the latest tag with GoDocs\nhelp                 Show this help message\ninstall              Install the application\ninstall              Run the Custom installation\ninstall-go           Install the application (Using Native Go)\nlint                 Run the golangci-lint application (install if not found)\nrelease              Full production release (creates release in Github)\nrelease              Runs common.release then runs godocs\nrelease-snap         Test the full release (build binaries)\nrelease-test         Full production test release (everything except deploy)\nreplace-version      Replaces the version in HTML/JS (pre-deploy)\nrun                  Runs the application\nrun-examples         Runs all the examples\nschema               Run the Model/schema generation\ntag                  Generate a new tag and push (tag version=0.0.0)\ntag-remove           Remove a tag if found (tag-remove version=0.0.0)\ntag-update           Update an existing tag to current commit (tag-update version=0.0.0)\ntest                 Runs lint and ALL tests\ntest-ci              Runs all tests via CI (exports coverage)\ntest-ci-no-race      Runs all tests via CI (no race) (exports coverage)\ntest-ci-short        Runs unit tests via CI (exports coverage)\ntest-no-lint         Runs just tests\ntest-short           Runs vet, lint and tests (excludes integration tests)\ntest-unit            Runs tests and outputs coverage\nuninstall            Uninstall the application (and remove files)\nupdate-linter        Update the golangci-lint package (macOS only)\nvet                  Run the Go vet application\n```\n\u003c/details\u003e\n\n\u003cdetails\u003e\n\u003csummary\u003e\u003cstrong\u003e\u003ccode\u003eModel Generation\u003c/code\u003e\u003c/strong\u003e\u003c/summary\u003e\n\u003cbr/\u003e\n\nUpdate the `reset_api_database.sql` if you have issues running the model tests\n```sql\nGRANT ALL ON `dynamic-database-name-generated-from-sql-boiler`.* to 'apiDbTestUser'@'%';\n```\n\nRebuilding the generated models/schema from the database schema:\n```shell script\nmake schema\n```\n\nClear local redis and reload the database\n```shell script\nmake db\nmake flush-redis\n```\n\u003c/details\u003e\n\n\u003cdetails\u003e\n\u003csummary\u003e\u003cstrong\u003e\u003ccode\u003eEnvironment Variables\u003c/code\u003e\u003c/strong\u003e\u003c/summary\u003e\n\u003cbr/\u003e\n\nAll environment variables are referenced in the [config](config/config.go).\n\nEdit the [`scripts/set_env.sh`](scripts/set_env.sh) file and modify the environment variables - IE:\n```shell script\nexport API_SERVER_PORT=3000\n```\n\u003c/details\u003e\n\n\u003cbr/\u003e\n\n## Examples \u0026 Tests\nAll unit tests and examples run via [GitHub Actions](https://github.com/tonicpow/go-paymail/actions) and\nuses [Go version 1.19.x](https://golang.org/doc/go1.19). View the [configuration file](.github/workflows/run-tests.yml).\n\nRun all tests (including integration tests)\n```shell script\nmake test\n```\n\nRun tests (excluding integration tests)\n```shell script\nmake test-short\n```\n\n\u003cbr/\u003e\n\n## Benchmarks\nRun the Go benchmarks:\n```shell script\nmake bench\n```\n\n\u003cbr/\u003e\n\n## Code Standards\nRead more about this Go project's [code standards](.github/CODE_STANDARDS.md).\n\n\u003cbr/\u003e\n\n## Usage\n(Coming soon: Examples!)\n\n\u003cbr/\u003e\n\n## Maintainers\n| [\u003cimg src=\"https://github.com/mrz1836.png\" height=\"50\" alt=\"MrZ\" /\u003e](https://github.com/mrz1836) |\n|:------------------------------------------------------------------------------------------------:|\n|                                [MrZ](https://github.com/mrz1836)                                 |\n\n\u003cbr/\u003e\n\n## Contributing\nView the [contributing guidelines](.github/CONTRIBUTING.md) and please follow the [code of conduct](.github/CODE_OF_CONDUCT.md).\n\n### How can I help?\nAll kinds of contributions are welcome :raised_hands:! \nThe most basic way to show your support is to star :star2: the project, or to raise issues :speech_balloon:. \nYou can also support this project by [becoming a sponsor on GitHub](https://github.com/sponsors/mrz1836) :clap: \nor by making a [**bitcoin donation**](https://mrz1818.com/?tab=tips\u0026af=go-sanitize) to ensure this journey continues indefinitely! :rocket:\n\n\u003cbr/\u003e\n\n## License\n\n[![License](https://img.shields.io/github/license/mrz1836/go-api.svg?style=flat\u0026v=1)](LICENSE)\n","funding_links":["https://github.com/sponsors/mrz1836","https://mrz1818.com/?tab=tips\u0026af=go-api"],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmrz1836%2Fgo-api","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmrz1836%2Fgo-api","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmrz1836%2Fgo-api/lists"}