{"id":18853652,"url":"https://github.com/arcenojackson/polls","last_synced_at":"2026-04-02T18:53:29.343Z","repository":{"id":258058938,"uuid":"756070097","full_name":"arcenojackson/polls","owner":"arcenojackson","description":"NodeJS/Fastfy project for polls application developed at NLW-Experts","archived":false,"fork":false,"pushed_at":"2024-02-11T22:05:11.000Z","size":1180,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2024-12-30T18:19:27.314Z","etag":null,"topics":["fastify","nodejs","postgresql","prisma-orm","redis","typescript","websockets"],"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/arcenojackson.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-11T22:05:05.000Z","updated_at":"2024-02-11T22:06:17.000Z","dependencies_parsed_at":"2024-10-17T13:52:44.797Z","dependency_job_id":"c79add2a-2a13-46b0-872a-e7549132ad1b","html_url":"https://github.com/arcenojackson/polls","commit_stats":null,"previous_names":["arcenojackson/polls"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/arcenojackson%2Fpolls","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/arcenojackson%2Fpolls/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/arcenojackson%2Fpolls/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/arcenojackson%2Fpolls/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/arcenojackson","download_url":"https://codeload.github.com/arcenojackson/polls/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":239793054,"owners_count":19697893,"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":["fastify","nodejs","postgresql","prisma-orm","redis","typescript","websockets"],"created_at":"2024-11-08T03:45:12.784Z","updated_at":"2025-12-30T22:59:30.482Z","avatar_url":"https://github.com/arcenojackson.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"![Cover](./.github/cover.png)\n\n# NLW Expert (Node.js)\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 (`npm install`);\n- Setup PostgreSQL and Redis (`docker compose up -d`);\n- Copy `.env.example` file (`cp .env.example .env`);\n- Run application (`npm 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\": [\n    \"JavaScript\",\n    \"Java\",\n    \"PHP\",\n    \"C#\"\n  ]\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%2Farcenojackson%2Fpolls","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Farcenojackson%2Fpolls","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Farcenojackson%2Fpolls/lists"}