{"id":20106846,"url":"https://github.com/py4mac/fizzbuzz","last_synced_at":"2026-05-16T17:05:25.757Z","repository":{"id":65518408,"uuid":"525513446","full_name":"py4mac/fizzbuzz","owner":"py4mac","description":"Fizzbuzz Technical Test","archived":false,"fork":false,"pushed_at":"2023-01-26T21:33:26.000Z","size":209,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-06-03T03:44:29.889Z","etag":null,"topics":["golang","grafana","monitoring","prometheus"],"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/py4mac.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}},"created_at":"2022-08-16T19:18:46.000Z","updated_at":"2022-09-03T09:10:08.000Z","dependencies_parsed_at":"2023-02-15T00:31:17.527Z","dependency_job_id":null,"html_url":"https://github.com/py4mac/fizzbuzz","commit_stats":null,"previous_names":[],"tags_count":1,"template":false,"template_full_name":null,"purl":"pkg:github/py4mac/fizzbuzz","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/py4mac%2Ffizzbuzz","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/py4mac%2Ffizzbuzz/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/py4mac%2Ffizzbuzz/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/py4mac%2Ffizzbuzz/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/py4mac","download_url":"https://codeload.github.com/py4mac/fizzbuzz/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/py4mac%2Ffizzbuzz/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":279101335,"owners_count":26103776,"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","status":"online","status_checked_at":"2025-10-15T02:00:07.814Z","response_time":56,"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":["golang","grafana","monitoring","prometheus"],"created_at":"2024-11-13T17:54:57.618Z","updated_at":"2025-10-24T20:51:20.615Z","avatar_url":"https://github.com/py4mac.png","language":"Go","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Go Fizzbuzz implementation with PostgreSQL\n\n[![Test](https://github.com/py4mac/fizzbuzz/workflows/Test/badge.svg)](https://github.com/py4mac/fizzbuzz/releases/latest)\n[![codecov](https://codecov.io/gh/py4mac/fizzbuzz/branch/main/graph/badge.svg)](https://codecov.io/gh/py4mac/fizzbuzz)\n\nExercise: Write a simple fizz-buzz REST server.\n\n\"The original fizz-buzz consists in writing all numbers from 1 to 100, and just replacing all multiples of 3 by \"\"fizz\"\", all multiples of 5 by \"\"buzz\"\", and all multiples of 15 by \"\"fizzbuzz\"\".\nThe output would look like this: \"\"1,2,fizz,4,buzz,fizz,7,8,fizz,buzz,11,fizz,13,14,fizzbuzz,16,...\"\".\"\n\nYour goal is to implement a web server that will expose a REST API endpoint that:\n\n- Accepts five parameters: three integers int1, int2 and limit, and two strings str1 and str2.\n- Returns a list of strings with numbers from 1 to limit, where: all multiples of int1 are replaced by str1, all multiples of int2 are replaced by str2, all multiples of int1 and int2 are replaced by str1str2.\n\nThe server needs to be:\n\n- Ready for production\n- Easy to maintain by other developers\n\nBonus: add a statistics endpoint allowing users to know what the most frequent request has been. This endpoint should:\n\n- Accept no parameter\n- Return the parameters corresponding to the most used request, as well as the number of hits for this request\n\n# Setup local development\n\n## Clone repository\n\n```sh\n❯ git clone git@github.com:py4mac/fizzbuzz.git\n```\n\n## Install tools\n\nThe following tools are required to be installed on local machine.\n\n[Golang](https://go.dev/) in version 1.19\u003cbr/\u003e\n[Docker](https://www.docker.com/products/docker-desktop/) docker and docker-compose\u003cbr/\u003e\n[Linter](https://golangci-lint.run/usage/install/) for linter source code\u003cbr/\u003e\n[Swag](https://github.com/swaggo/swag) for generating swagger documentation\u003cbr/\u003e\n[Migrate](https://github.com/golang-migrate/migrate) for database migrations\u003cbr/\u003e\n[Mock](https://github.com/golang/mock) for mocking\u003cbr/\u003e\n[Godoc](https://github.com/golang/mock) for generating live documentation, to install it run `❯ go install golang.org/x/tools/cmd/godoc@latest`\u003cbr/\u003e\n\n## Other stacks\n\nThese other stacks are already pre-installed inside differents containers. No installation is required here, it's just for information.\n\n[PostgreSQL](https://github.com/jackc/pgx) as fizzbuzz persistent store\u003cbr/\u003e\n[Opentelemetry](https://opentelemetry.io/) for tracing\u003cbr/\u003e\n[Prometheus](https://prometheus.io/) monitoring and alerting\u003cbr/\u003e\n[Grafana](https://grafana.com/) to expose dashboards collecting Prometheus metrics\u003cbr/\u003e\n[Echo](https://github.com/labstack/echo) web framework\u003cbr/\u003e\n\n## Getting Started\n\n### Run unittest\n\n```sh\n❯ make test\n```\n\n### Run local containers\n\nThe following command starts PostgreSQL, Jaeger, Prometheus and Grafana containers.\n\n```sh\n❯ make start_local\n```\n\n### Initialize database\n\nOnece PostgreSQL container is running, the following command initialize the database.\n\n```sh\n❯ make migrate_up\n```\n\n### Run local application\n\n```sh\n❯ make run\n```\n\n# Services availables\n\nOnce local containers and local application is started, the following endpoints are availables.\n\n## Swagger\n\nIt exposes RestAPI handlers\nhttp://localhost:8000/swagger/index.html\n\n### Fizzbuzz\n\n**URL** : `/api/v1/fizzbuzz`\n\n**Method** : `GET`\n\n```sh\n❯ curl -i http://localhost:8000/api/v1/fizzbuzz\\?int1\\=3\\\u0026int2\\=5\\\u0026limit\\=100\\\u0026str1\\=fizz\\\u0026str2\\=buzz\nHTTP/1.1 200 OK\nContent-Type: application/json; charset=UTF-8\nVary: Origin\nDate: Thu, 18 Aug 2022 09:14:59 GMT\nContent-Length: 415\n\n\"1,2,fizz,4,buzz,fizz,7,8,fizz,buzz,11,fizz,13,14,fizzbuzz,16,17,fizz,19,buzz,fizz,22,23,fizz,buzz,26,fizz,28,29,fizzbuzz,31,32,fizz,34,buzz,fizz,37,38,fizz,buzz,41,fizz,43,44,fizzbuzz,46,47,fizz,49,buzz,fizz,52,53,fizz,buzz,56,fizz,58,59,fizzbuzz,61,62,fizz,64,buzz,fizz,67,68,fizz,buzz,71,fizz,73,74,fizzbuzz,76,77,fizz,79,buzz,fizz,82,83,fizz,buzz,86,fizz,88,89,fizzbuzz,91,92,fizz,94,buzz,fizz,97,98,fizz,buzz\"\n```\n\n### Stats\n\n**URL** : `/api/v1/stats`\n\n**Method** : `GET`\n\n```sh\n❯ curl -i http://localhost:8000/api/v1/stats\nHTTP/1.1 200 OK\nContent-Type: application/json; charset=UTF-8\nVary: Origin\nDate: Thu, 18 Aug 2022 09:16:09 GMT\nContent-Length: 70\n\n{\"hits\":20,\"int1\":3,\"int2\":5,\"limit\":100,\"str1\":\"fizz\",\"str2\":\"buzz\"}\n```\n\n## Metrics Endpoint\n\nhttp://localhost:8080/metrics\n\n## Jaeger\n\nhttp://localhost:16686\n\n## Prometheus\n\nhttp://localhost:9090\n\n## Grafana\n\nhttp://localhost:3000/d/3bB90wi4z/fizzbuzz\n\n## Stop local containers\n\n```sh\n❯ make stop_local\n```\n\n# Setup production environment\n\n### Run production containers\n\n```sh\n❯ make start_prod\n```\n\nand database migration script\n\n```sh\n❯ make migrate_up\n```\n\n# Services availables\n\nOnce production containers are started, the same services are started. The same endpoints are also availables.\n\n# Source code documentation\n\nAn other command is available to explore live documentation\n\n```sh\n❯ make doc\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fpy4mac%2Ffizzbuzz","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fpy4mac%2Ffizzbuzz","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fpy4mac%2Ffizzbuzz/lists"}