{"id":17322388,"url":"https://github.com/jenting/clickfarmer","last_synced_at":"2025-03-27T03:40:25.406Z","repository":{"id":183992332,"uuid":"483034613","full_name":"jenting/clickfarmer","owner":"jenting","description":null,"archived":false,"fork":false,"pushed_at":"2024-04-08T12:15:12.000Z","size":436,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2024-04-09T14:37:38.253Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"Go","has_issues":false,"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/jenting.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":".github/CODEOWNERS","security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null}},"created_at":"2022-04-18T23:59:55.000Z","updated_at":"2024-04-15T12:28:00.344Z","dependencies_parsed_at":"2023-07-26T17:32:17.944Z","dependency_job_id":"b78fd6f0-0e90-48aa-930e-b4811d7bbb51","html_url":"https://github.com/jenting/clickfarmer","commit_stats":null,"previous_names":["jenting/clickfarmer"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jenting%2Fclickfarmer","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jenting%2Fclickfarmer/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jenting%2Fclickfarmer/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jenting%2Fclickfarmer/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/jenting","download_url":"https://codeload.github.com/jenting/clickfarmer/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":245779431,"owners_count":20670684,"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":[],"created_at":"2024-10-15T13:41:59.420Z","updated_at":"2025-03-27T03:40:25.374Z","avatar_url":"https://github.com/jenting.png","language":"Go","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Click Farmer\n\nMake sure to read the \"Additional Notes\" section at the bottom for some important\ninformation.\n\n## The Problem\n\nThe click farming business has really taken off recently.\n\nThe original click farming engineers started this project to count the number of\nclicks around the world. However, they left to start another business.\n\nThey created a design document that describes how the system works, but they never\ngot around to finishing. We're not quite sure whether everything is correct either.\n\nThey say the system they left for you consists of a core database service they\nwrote. In addition, they wrote a webserver. They expect to run many webservers\nagainst one database concurrently, to handle the clickfarming load.\n\nIn the database folder you'll find the RPC server implementation that handles\ndatabase requests.\n\nIn the webserver folder you'll find the HTTP handlers and code which talks to\nthe database using protobuf + grpc defined in the pb folder.\n\nIn the docs folder you'll find the design document that the click farming\nengineers wrote.\n\nThe goal is to get the product working to farm upvotes from around the world.\n\n## Building and Running\n\nTo build the binary:\n```\ngo build -o clickfarmer -race -v .\n```\n\nTo run the database:\n```\n./clickfarmer database\n```\nYou can specify an `--rpc-addr \u003caddr\u003e` flag to set the RPC server address the\ndatabase listens for requests on to something other than \":8080\".\n\nTo run a webserver:\n```\n./clickfarmer webserver\n```\nYou can specify an `--rpc-addr \u003caddr\u003e` flag to set the address to connect to\nthe database on (it defaults to \"localhost:8080\").\n\nYou can specify an `--http-addr \u003caddr\u003e` (or `-a`) flag to set the address to\nserve the website on. This is used to run multiple web servers, like:\n\n```\n./clickfarmer webserver -a :3001\n./clickfarmer webserver -a :3002\n./clickfarmer webserver -a :3003\n```\n\nNote that you can also run the database and webserver without the `build` step\nby running the `main.go` file directly:\n\n```\ngo run main.go database\ngo run main.go webserver -a :3002\n```\n\nTo access the webserver's frontend, go to http://localhost:3000 in a browser (if\nyou used `--http-addr` or `-a` to specify a different one, use that port\ninstead of `3000`).\n\n## Generating Protobufs\n\nYou will need to install the protobuf compiler:\n\nhttps://grpc.io/docs/protoc-installation/\n\nAs well as some additional dependencies:\n\n```\ngo get google.golang.org/protobuf/cmd/protoc-gen-go \\\n         google.golang.org/grpc/cmd/protoc-gen-go-grpc\n```\n\nTo re-generate the protobuf code after changing `pb/clicktracking.proto`, run:\n```\ngo generate ./pb/...\n```\n\n## Additional Notes\n\nIn order to get full credit you must make sure the following endpoints work\non the webserver API:\n```\nGET /api/clicks/red -\u003e returns a single integer representing total red button clicks (`0`)\nGET /api/clicks/green -\u003e returns a single integer representing total green button clicks\nGET /api/clicks/blue -\u003e returns a single integer representing total blue button clicks\nGET /api/clicks -\u003e returns JSON like `{\"redClicks\": 0, \"greenClicks\": 0, \"blueClicks\": 0}`\nPUT /api/clicks/red -\u003e called when the red button was clicked once. no return data\nPUT /api/clicks/green -\u003e called when the green button was clicked once. no return data\nPUT /api/clicks/blue -\u003e called when the blue button was clicked once. no return data\n```\n\nYou must match this behavior for all of these endpoints - we use them to test\nyour solution.\n\nYou also must keep the same command line functionality. Our testing software\nexpects to be able to start a webserver like\n`./clickfarmer webserver -a :port` and expects to start a database like\n`./clickfarmer database`. It expects that each webserver syncs with the database\nevery 1 second.\n\nYou must keep the webserver/database architecture. Our testing software expects\nto run multiple webservers against a database. However, you can do whatever\nyou want in terms of the webserver and database's internal logic, as well as the\nmessages and RPC functions they use to communicate.\n\nThere are two components to your homework evaluation:\n* Backend - we will run automated tests to determine whether your API is able to correctly handle requests, including when multiple APIs are running against the same database\n* Frontend - we will look at the html page served by your web server and assign points based on responsiveness to different screen sizes, and design decisions such as color and element spacing/positioning\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjenting%2Fclickfarmer","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fjenting%2Fclickfarmer","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjenting%2Fclickfarmer/lists"}