{"id":19571550,"url":"https://github.com/rodrigofontesdev/polls","last_synced_at":"2026-04-11T02:40:53.280Z","repository":{"id":222045575,"uuid":"754895054","full_name":"rodrigofontesdev/polls","owner":"rodrigofontesdev","description":"Real-time voting system built with Node.js.","archived":false,"fork":false,"pushed_at":"2024-02-14T02:45:54.000Z","size":37,"stargazers_count":0,"open_issues_count":0,"forks_count":1,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-01-09T03:13:38.278Z","etag":null,"topics":["fastify","nodejs","postgresql","prisma","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":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/rodrigofontesdev.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE.md","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-09T00:52:30.000Z","updated_at":"2024-07-17T23:21:19.000Z","dependencies_parsed_at":null,"dependency_job_id":"47274f3f-3db0-488c-823e-1e3c1b8be1d2","html_url":"https://github.com/rodrigofontesdev/polls","commit_stats":null,"previous_names":["rodrigofontesdev/polls"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rodrigofontesdev%2Fpolls","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rodrigofontesdev%2Fpolls/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rodrigofontesdev%2Fpolls/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rodrigofontesdev%2Fpolls/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/rodrigofontesdev","download_url":"https://codeload.github.com/rodrigofontesdev/polls/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":240840032,"owners_count":19866164,"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","redis","typescript","websockets"],"created_at":"2024-11-11T06:19:16.198Z","updated_at":"2026-04-11T02:40:48.253Z","avatar_url":"https://github.com/rodrigofontesdev.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"![cover](https://github.com/rodrigofontesdev/polls/assets/17281370/19108157-7049-4fde-aba1-1dce097321f8)\n\n# Polls\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## Prerequisites\n\n- Node.js\n- Docker\n- Git\n\n## Getting Started\n\n- Clone the repository (`git clone git@github.com:rodrigofontesdev/polls.git`)\n- Install dependencies (`npm install`)\n- Setup PostgreSQL and Redis (`docker compose up -d`)\n- Check if PostgreSQL and Redis containers is running (`docker ps`)\n- Copy .env.example file (`cp .env.example .env`)\n- Install database migrations (`npx prisma migrate dev`)\n- Run application (`npm run dev`)\n- Test it! (I personally recommend testing with [Hoppscotch](https://hoppscotch.io))\n\n## Prisma Studio\n\nPrisma Studio is a visual editor for the data in your database.\n\n- Run in your terminal (`npx prisma studio`)\n- Visit (`http://localhost:5555`)\n\n## Hoppscotch\n\nHoppscotch is an open-source API development ecosystem that helps you create and test your API requests.\n\n### Setup\n\n- Install the **Hoppscotch Browser Extension** ([Read more here](https://docs.hoppscotch.io/documentation/getting-started/setup#locally-served-apis))\n- Open two tabs on browser for Hoppscotch, select **REST** and **Realtime** options in each tab\n- Authorization: No Auth\n\n## How to use\n\n### HTTP\n\n### POST `/polls`\n\nCreate a new poll.\n\n**Request body**\n\n```json\n{\n    \"title\": \"What's the best programming language?\",\n    \"options\": [\n        \"JavaScript\",\n        \"PHP\",\n        \"Python\",\n        \"C#\"\n    ]\n}\n```\n\n**Response body**\n\n```json\n{\n    \"pollId\": \"4f111485-be0c-41d5-8f2a-cb9e8933cd2f\"\n}\n```\n\n### GET `/polls/:pollId`\n\nReturn data from a single poll.\n\n**Request body**\n\n`No request body`\n\n**Response body**\n\n```json\n{\n  \"poll\": {\n    \"id\": \"4f111485-be0c-41d5-8f2a-cb9e8933cd2f\",\n    \"title\": \"What's the best programming language?\",\n    \"options\": [\n      {\n        \"id\": \"3ef7ed4d-0064-4c95-9788-b96033fc1755\",\n        \"title\": \"JavaScript\",\n        \"score\": 0\n      },\n      {\n        \"id\": \"bfc8a311-0c9a-4753-b1a3-eebfd1fd1480\",\n        \"title\": \"PHP\",\n        \"score\": 0\n      },\n      {\n        \"id\": \"0ea30528-14be-4465-b810-b79eb8211ed8\",\n        \"title\": \"Python\",\n        \"score\": 0\n      },\n      {\n        \"id\": \"337298a6-f7b7-4334-8b6b-9c8d17b697c2\",\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\": \"3ef7ed4d-0064-4c95-9788-b96033fc1755\"\n}\n```\n\n**Response body**\n\n`No response body`\n\n### WebSockets\n\n### ws `/polls/:pollId/results`\n\nReturn votes in realtime on a specific poll.\n\n**Response body**\n\n```json\n{\n    \"pollOptionId\": \"3ef7ed4d-0064-4c95-9788-b96033fc1755\",\n    \"votes\": 1\n}\n```\n\n## Built With\n\n- Node.js\n- Typescript\n- Redis\n- PostgreSQL\n- WebSockets\n\n## License\n\nThis project is licensed under the MIT License - see the [LICENSE.md](https://github.com/rodrigofontesdev/polls/blob/main/LICENSE.md) file for details.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Frodrigofontesdev%2Fpolls","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Frodrigofontesdev%2Fpolls","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Frodrigofontesdev%2Fpolls/lists"}