{"id":24794844,"url":"https://github.com/hugorcd/nuxt-visitors","last_synced_at":"2025-04-09T06:11:55.030Z","repository":{"id":274598159,"uuid":"923436539","full_name":"HugoRCD/nuxt-visitors","owner":"HugoRCD","description":"Add real-time visitor tracking to your Nuxt app with one line of code. WebSocket made easy","archived":false,"fork":false,"pushed_at":"2025-04-07T18:34:35.000Z","size":177,"stargazers_count":69,"open_issues_count":4,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-04-07T19:39:31.496Z","etag":null,"topics":["analytics","nuxt","realtime","visitors","websocket"],"latest_commit_sha":null,"homepage":"https://nuxt-visitors.nuxt.dev/","language":"TypeScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/HugoRCD.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":".github/funding.yml","license":"LICENSE","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},"funding":{"github":["HugoRCD"]}},"created_at":"2025-01-28T08:40:40.000Z","updated_at":"2025-04-04T10:33:18.000Z","dependencies_parsed_at":"2025-02-21T12:20:36.265Z","dependency_job_id":"51a13b51-b5b1-4ebd-a258-affd46fa508e","html_url":"https://github.com/HugoRCD/nuxt-visitors","commit_stats":null,"previous_names":["hugorcd/nuxt-visitors"],"tags_count":3,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/HugoRCD%2Fnuxt-visitors","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/HugoRCD%2Fnuxt-visitors/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/HugoRCD%2Fnuxt-visitors/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/HugoRCD%2Fnuxt-visitors/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/HugoRCD","download_url":"https://codeload.github.com/HugoRCD/nuxt-visitors/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247987285,"owners_count":21028895,"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":["analytics","nuxt","realtime","visitors","websocket"],"created_at":"2025-01-29T23:18:30.820Z","updated_at":"2025-04-09T06:11:54.997Z","avatar_url":"https://github.com/HugoRCD.png","language":"TypeScript","funding_links":["https://github.com/sponsors/HugoRCD"],"categories":[],"sub_categories":[],"readme":"# Nuxt Visitors 👀\n\n\u003c!-- automd:badges color=black license provider=shields name=nuxt-visitors --\u003e\n\n[![npm version](https://img.shields.io/npm/v/nuxt-visitors?color=black)](https://npmjs.com/package/nuxt-visitors)\n[![npm downloads](https://img.shields.io/npm/dm/nuxt-visitors?color=black)](https://npm.chart.dev/nuxt-visitors)\n[![license](https://img.shields.io/github/license/HugoRCD/nuxt-visitors?color=black)](https://github.com/HugoRCD/nuxt-visitors/blob/main/LICENSE)\n\n\u003c!-- /automd --\u003e\n\nAdd live visitor counting to your Nuxt website in seconds. WebSocket-based, type-safe, and completely automatic.\n\n## Features ⚡️\n\n- 🔄 Real-time updates via WebSocket\n- 🪄 Zero configuration needed\n- 🛠 Automatic connection management\n- 📊 Type-safe composable\n- 🧹 Auto cleanup on unmount\n- 🌐 Leverages [Nitro WebSocket](https://nitro.unjs.io/guide/websocket) with Pub/Sub\n\n## Installation\n\nInstall the module to your Nuxt application with one command:\n\n```bash\nnpx nuxi module add nuxt-visitors\n```\n\nAs [Nitro WebSocket support](https://nitro.unjs.io/guide/websocket) is experimental, you need to enable it in your `nuxt.config.ts`:\n\n```ts\nexport default defineNuxtConfig({\n  modules: ['nuxt-visitors'],\n  nitro: {\n    experimental: {\n      websocket: true\n    }\n  }\n})\n```\n\n## Usage\n\n```vue\n\u003cscript setup lang=\"ts\"\u003e\nconst { visitors } = useVisitors()\n\u003c/script\u003e\n\n\u003ctemplate\u003e\n  \u003cdiv\u003eActive users: {{ visitors }}\u003c/div\u003e\n\u003c/template\u003e\n```\n\nThat's it! The module handles everything else automatically:\n- WebSocket connection management\n- Real-time updates\n- Reconnection logic\n- Error handling\n\n### Advanced usage\n\nThe composable provides additional features:\n```ts\nconst {\nvisitors,     // Ref\u003cnumber\u003e - Current visitor count\nisConnected,  // Ref\u003cboolean\u003e - Connection status\nisLoading,    // Ref\u003cboolean\u003e - Loading state\nerror,        // Ref\u003cstring | null\u003e - Error message if any\nreconnect     // () =\u003e void - Manual reconnection\n} = useVisitors()\n```\n\n\u003c!-- automd:fetch url=\"gh:hugorcd/markdown/main/src/contributions.md\" --\u003e\n\n## Contributing\nTo start contributing, you can follow these steps:\n\n1. First raise an issue to discuss the changes you would like to make.\n2. Fork the repository.\n3. Create a branch using conventional commits and the issue number as the branch name. For example, `feat/123` or `fix/456`.\n4. Make changes following the local development steps.\n5. Commit your changes following the [Conventional Commits](https://www.conventionalcommits.org/en/v1.0.0/) specification.\n6. If your changes affect the code, run tests using `bun run test`.\n7. Create a pull request following the [Pull Request Template](https://github.com/HugoRCD/markdown/blob/main/src/pull_request_template.md).\n   - To be merged, the pull request must pass the tests/workflow and have at least one approval.\n   - If your changes affect the documentation, make sure to update it.\n   - If your changes affect the code, make sure to update the tests.\n8. Wait for the maintainers to review your pull request.\n9. Once approved, the pull request will be merged in the next release !\n\n\u003c!-- /automd --\u003e\n\n\u003c!-- automd:contributors license=Apache author=HugoRCD github=HugoRCD/nuxt-visitors --\u003e\n\nPublished under the [APACHE](https://github.com/HugoRCD/nuxt-visitors/blob/main/LICENSE) license.\nMade by [@HugoRCD](https://github.com/HugoRCD) and [community](https://github.com/HugoRCD/nuxt-visitors/graphs/contributors) 💛\n\u003cbr\u003e\u003cbr\u003e\n\u003ca href=\"https://github.com/HugoRCD/nuxt-visitors/graphs/contributors\"\u003e\n\u003cimg src=\"https://contrib.rocks/image?repo=HugoRCD/nuxt-visitors\" /\u003e\n\u003c/a\u003e\n\n\u003c!-- /automd --\u003e\n\n\u003c!-- automd:with-automd lastUpdate --\u003e\n\n---\n\n_🤖 auto updated with [automd](https://automd.unjs.io) (last updated: Tue Jan 28 2025)_\n\n\u003c!-- /automd --\u003e\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fhugorcd%2Fnuxt-visitors","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fhugorcd%2Fnuxt-visitors","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fhugorcd%2Fnuxt-visitors/lists"}