{"id":18982612,"url":"https://github.com/rafaelalmendra/polls-api","last_synced_at":"2026-04-05T08:35:40.738Z","repository":{"id":221428786,"uuid":"754352665","full_name":"Rafaelalmendra/polls-api","owner":"Rafaelalmendra","description":"Real-time voting system built with Node.js","archived":false,"fork":false,"pushed_at":"2024-02-08T22:33:15.000Z","size":11810,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2026-01-03T18:13:19.765Z","etag":null,"topics":["fastify","nodejs","postgresql","prisma","redis","typescript","websocket"],"latest_commit_sha":null,"homepage":"","language":"TypeScript","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/Rafaelalmendra.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-02-07T21:59:12.000Z","updated_at":"2024-02-08T18:23:06.000Z","dependencies_parsed_at":"2024-02-07T23:24:24.644Z","dependency_job_id":"8fdd4551-d7de-42a5-b9d0-9409a2cab191","html_url":"https://github.com/Rafaelalmendra/polls-api","commit_stats":null,"previous_names":["rafaelalmendra/polls-api"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/Rafaelalmendra/polls-api","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Rafaelalmendra%2Fpolls-api","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Rafaelalmendra%2Fpolls-api/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Rafaelalmendra%2Fpolls-api/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Rafaelalmendra%2Fpolls-api/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/Rafaelalmendra","download_url":"https://codeload.github.com/Rafaelalmendra/polls-api/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Rafaelalmendra%2Fpolls-api/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":31430009,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-04-05T08:13:15.228Z","status":"ssl_error","status_checked_at":"2026-04-05T08:13:11.839Z","response_time":75,"last_error":"SSL_read: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"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":["fastify","nodejs","postgresql","prisma","redis","typescript","websocket"],"created_at":"2024-11-08T16:14:11.993Z","updated_at":"2026-04-05T08:35:40.465Z","avatar_url":"https://github.com/Rafaelalmendra.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"\u003cimg src=\"./github/cover.png\"/\u003e\n\n# About\n\nA real-time voting system where users can create a poll and other users can cast their votes. The system generates a ranking among the options and updates the votes in real-time.\n\n## Requisites\n\n- Docker;\n- Node.js;\n\n## Setup\n\n- Clone the repository;\n- Install dependencies (`pnpm install`);\n- Setup PostgreSQL and Redis (`docker compose up -d`);\n- Copy `.env.example` file (`cp .env.example .env`);\n- Run application (`pnpm run dev`);\n- Test it! (I personally recommend testing with [Hoppscotch](https://hoppscotch.io/)).\n\n## HTTP\n\n### POST `/polls`\n\nCreate a new poll.\n\n#### Request body\n\n```json\n{\n  \"title\": \"Qual a melhor linguagem de programação?\",\n  \"options\": [\"JavaScript\", \"Java\", \"PHP\", \"C#\"]\n}\n```\n\n#### Response body\n\n```json\n{\n  \"pollId\": \"194cef63-2ccf-46a3-aad1-aa94b2bc89b0\"\n}\n```\n\n### GET `/polls/:pollId`\n\nReturn data from a single poll.\n\n#### Response body\n\n```json\n{\n  \"poll\": {\n    \"id\": \"e4365599-0205-4429-9808-ea1f94062a5f\",\n    \"title\": \"Qual a melhor linguagem de programação?\",\n    \"options\": [\n      {\n        \"id\": \"4af3fca1-91dc-4c2d-b6aa-897ad5042c84\",\n        \"title\": \"JavaScript\",\n        \"score\": 1\n      },\n      {\n        \"id\": \"780b8e25-a40e-4301-ab32-77ebf8c79da8\",\n        \"title\": \"Java\",\n        \"score\": 0\n      },\n      {\n        \"id\": \"539fa272-152b-478f-9f53-8472cddb7491\",\n        \"title\": \"PHP\",\n        \"score\": 0\n      },\n      {\n        \"id\": \"ca1d4af3-347a-4d77-b08b-528b181fe80e\",\n        \"title\": \"C#\",\n        \"score\": 0\n      }\n    ]\n  }\n}\n```\n\n### POST `/polls/:pollId/votes`\n\nAdd a vote to specific poll.\n\n#### Request body\n\n```json\n{\n  \"pollOptionId\": \"31cca9dc-15da-44d4-ad7f-12b86610fe98\"\n}\n```\n\n## WebSockets\n\n### ws `/polls/:pollId/results`\n\n#### Message\n\n```json\n{\n  \"pollOptionId\": \"da9601cc-0b58-4395-8865-113cbdc42089\",\n  \"votes\": 2\n}\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Frafaelalmendra%2Fpolls-api","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Frafaelalmendra%2Fpolls-api","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Frafaelalmendra%2Fpolls-api/lists"}