{"id":15486111,"url":"https://github.com/conejerock/nuxt-unleash","last_synced_at":"2025-04-22T15:41:01.849Z","repository":{"id":45173119,"uuid":"469828559","full_name":"conejerock/nuxt-unleash","owner":"conejerock","description":"Nuxt.js module to use Unleash toggle feature services","archived":false,"fork":false,"pushed_at":"2023-12-17T10:21:42.000Z","size":994,"stargazers_count":20,"open_issues_count":1,"forks_count":1,"subscribers_count":2,"default_branch":"main","last_synced_at":"2025-04-17T04:19:23.763Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"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/conejerock.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":null,"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}},"created_at":"2022-03-14T17:03:03.000Z","updated_at":"2023-09-26T08:20:33.000Z","dependencies_parsed_at":"2023-12-31T04:02:56.624Z","dependency_job_id":null,"html_url":"https://github.com/conejerock/nuxt-unleash","commit_stats":{"total_commits":22,"total_committers":3,"mean_commits":7.333333333333333,"dds":0.09090909090909094,"last_synced_commit":"2ddab162511a7f39cc5ae9b9537e14a4cce3afee"},"previous_names":[],"tags_count":3,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/conejerock%2Fnuxt-unleash","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/conejerock%2Fnuxt-unleash/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/conejerock%2Fnuxt-unleash/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/conejerock%2Fnuxt-unleash/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/conejerock","download_url":"https://codeload.github.com/conejerock/nuxt-unleash/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":250269852,"owners_count":21402950,"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-02T06:06:35.120Z","updated_at":"2025-04-22T15:41:01.822Z","avatar_url":"https://github.com/conejerock.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"\u003cp align=\"center\"\u003e\n    \u003cimg src=\"[https://raw.githubusercontent.com/conejerock/nuxt-unleash/main/docs/icon.svg](https://github.com/conejerock/nuxt-unleash/blob/main/docs/nuxt-unleash.svg)\" width=\"300\"\u003e\n\u003c/p\u003e\n\n# nuxt-unleash\n\n[![npm version][npm-version-src]][npm-version-href]\n[![npm downloads][npm-downloads-src]][npm-downloads-href]\n[![Github Actions CI][github-actions-ci-src]][github-actions-ci-href]\n[![Codecov][codecov-src]][codecov-href]\n[![License][license-src]][license-href]\n\n\u003e Nuxt.js module to use [Unleash](https://github.com/Unleash/unleash) toggle feature services\n\n[📖 **Release Notes**](./CHANGELOG.md)\n\n## Features\n\nUse `$unleash` to access and handle your *Unleash* feature flags in client side,\nor `context.app.unleash` to access _Unleash_ feature flags from server side.\n\n## Setup\n\n1. Add `nuxt-unleash` dependency to your project\n\n```bash\nyarn add nuxt-unleash\n```\n\n2. Add `nuxt-unleash` to the `modules` section of `nuxt.config.js`\n\n```js\nexport default {\n  modules: [\n    // Simple usage\n    'nuxt-unleash',\n\n    // With options\n    ['nuxt-unleash', { /* module options */ }]\n  ]\n}\n```\n\n:warning: If you are using Nuxt **\u003c v2.9** you have to install the module as a `dependency` (No `--dev` or `--save-dev` flags) and use `modules` section in `nuxt.config.js` instead of `buildModules`.\n\n### Using top level options\n\n```js\nexport default {\n  buildModules: [\n    'nuxt-unleash'\n  ],\n  unleash: {\n    /* module options */\n  }\n}\n```\n\n## Options\n\n### `url`\n\n- Type: `String`\n- Required: `true`\n\nUnleash API URL\n\n### `instanceId`\n\n- Type: `String`\n- Required: `true`\n\nUnleash API Instance ID\n\n### `environment`\n\n- Type: `String`\n- Required: `false`\n\nName of the environment your Unleash application runs in. If is not filled in, the response will be an empty array. See the [example configuration](https://docs.gitlab.com/ee/operations/feature_flags.html#golang-application-example).\n\n### `config`\n\nThe module allows some configuration parameters.\n\n\nIf you want to default to the value of a feature that doesn't exist, use:\n\n`enabledDefault: true`\n\nOn the other hand, to set a header as the source of the ip, you can add:\n\n`headerIP: 'CF-Connection-IP'`\n\n\n\n## Usage\n\n#### Client Side\n\nTo access the module in __side client__ you just have to call `this.$unleash` and method you want to use.\n\n```js\n\u003ctemplate\u003e\n  \u003ch1\u003e{{ value ? 'enabled' : 'disabled' }}\u003c/h1\u003e\n\u003c/template\u003e\n\n\u003cscript\u003e\nexport default {\n  mounted() {\n    this.value = this.$unleash.isEnabled('new-feature')\n  }\n}\n\u003c/script\u003e\n\n```\n\n#### Sever Side\n\nTo access the module in __side server__ you just have to call `ctx.app.unleash` and method you want to use.\n\n```js\nasyncData(ctx) {\n  const value = ctx.app.unleash.isEnabled('new-feature')\n  if(value) {\n      ctx.redirect('/new-feature-page')\n  }\n}\n```\n\n### Methods\n\nThe library provides four methods:\n\n#### exists\nReturns whether a feature flag exists \n\n```js\n  this.$unleash.exists('new-feature')\n```\n\n#### isEnabled\nIf the feature flag exists, return its status value. Otherwise, return the value of module option `enabledDefault`.\n\n```js\n  this.$unleash.isEnabled('new-feature')\n```\n\n#### isAllowUser\nIf feature flag has the strategy `userWithId` as user list (comma separated), returns whether *myUsername* is in the user list of `userIds`.\n\n```js\n  this.$unleash.isAllowUser('new-feature', 'myUsername')\n```\n\n#### isAllowIP\nIf feature flag has the strategy `userWithId` as IP list (comma separated), returns whether the current request IP is in the IP list of `userIds`.\n\n```js\n  this.$unleash.isAllowIP('new-feature')\n```\n*Pd: It's necessary to activate **vuex** for this functionality*\n\n## Development\n\n1. Clone this repository\n2. Install dependencies using `yarn install` or `npm install`\n3. Start development server using `npm run dev`\n\n## License\n\n[MIT License](./LICENSE)\n\n\nCopyright (c) Conejerock\n\n\u003c!-- Badges --\u003e\n[npm-version-src]: https://img.shields.io/npm/v/nuxt-unleash/latest.svg\n[npm-version-href]: https://npmjs.com/package/nuxt-unleash\n\n[npm-downloads-src]: https://img.shields.io/npm/dt/nuxt-unleash.svg\n[npm-downloads-href]: https://npmjs.com/package/nuxt-unleash\n\n[github-actions-ci-src]: https://github.com/conejerock/nuxt-unleash/workflows/ci/badge.svg\n[github-actions-ci-href]: https://github.com/conejerock/nuxt-unleash/actions?query=workflow%3Aci\n\n[codecov-src]: https://img.shields.io/codecov/c/github/conejerock/nuxt-unleash.svg\n[codecov-href]: https://codecov.io/gh/conejerock/nuxt-unleash\n\n[license-src]: https://img.shields.io/npm/l/nuxt-unleash.svg\n[license-href]: https://npmjs.com/package/nuxt-unleash\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fconejerock%2Fnuxt-unleash","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fconejerock%2Fnuxt-unleash","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fconejerock%2Fnuxt-unleash/lists"}