{"id":13767338,"url":"https://github.com/use-lens/use-lens","last_synced_at":"2025-05-10T22:31:46.708Z","repository":{"id":64908113,"uuid":"534735627","full_name":"use-lens/use-lens","owner":"use-lens","description":"Check out the article on https://blog.andriishupta.dev/simplify-usage-of-lens-api-with-use-lens-and-graphql-codegen","archived":true,"fork":false,"pushed_at":"2023-02-15T10:56:16.000Z","size":977,"stargazers_count":50,"open_issues_count":0,"forks_count":3,"subscribers_count":2,"default_branch":"main","last_synced_at":"2025-05-06T10:08:16.681Z","etag":null,"topics":["graphql","lens-protocol","use-lens"],"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/use-lens.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-09-09T17:11:03.000Z","updated_at":"2025-03-18T11:59:42.000Z","dependencies_parsed_at":"2024-01-11T23:43:36.866Z","dependency_job_id":"a0755c36-3319-4e05-8301-9de6d8176f08","html_url":"https://github.com/use-lens/use-lens","commit_stats":{"total_commits":166,"total_committers":1,"mean_commits":166.0,"dds":0.0,"last_synced_commit":"660fa4dbd0f420ca582bdfb83a348e50a08cc135"},"previous_names":[],"tags_count":30,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/use-lens%2Fuse-lens","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/use-lens%2Fuse-lens/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/use-lens%2Fuse-lens/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/use-lens%2Fuse-lens/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/use-lens","download_url":"https://codeload.github.com/use-lens/use-lens/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":253214608,"owners_count":21872503,"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":["graphql","lens-protocol","use-lens"],"created_at":"2024-08-03T16:01:07.626Z","updated_at":"2025-05-10T22:31:43.760Z","avatar_url":"https://github.com/use-lens.png","language":"TypeScript","funding_links":[],"categories":["Development"],"sub_categories":["Libraries \u0026 Tools"],"readme":"# ⚠️ Deprecation notice ⚠️\n\u003e This experimental set of libraries is deprecated in favor of official [Lens Protocol's SDK](https://github.com/lens-protocol/lens-sdk) on 15th of February 2023.\n\n\u003e For `@use-lens/react-apollo` use \"Emergency Eject\"(down below)\n\u003e \n\u003e For `@use-lens/cli` no action required, except updating Lens's GraphQL API manually.\n\n# 🌱 Use Lens\n`use-lens/use-lens` is a monorepo that contains packages and CLI with generated GraphQL code for easier Lens API use.\n\nThese packages don't change Lens API but simplify usage by providing generated hooks, services, components, etc., for different frameworks.\n\nFind Lens API documentation by the link:\n\n🌿 https://docs.lens.xyz.\n\nGeneration is made with awesome package [graphql-code-generator](https://github.com/dotansimha/graphql-code-generator).\n\n## ⚠️ CAUTION\n🌿 https://docs.lens.xyz/docs/introduction:\n\u003e This API is beta and not production complete yet, which means that we could change schemas and endpoints at any time without warning or notice to you. When this API is production ready, we will remove this beta warning and will endeavor to ensure that there are no changes going forward unless a major change to the protocol itself is required.\n\nLens API is not production complete, and so is `@use-lens/*`. Please, keep this in mind when going to the production.\n\nThe update process of `@use-lens/*` is **manual** because Lens API is currently private, in beta, and doesn't have release schedules, etc.\n\nAlso, I would briefly explain how I see the best use of `@use-lens/*` at this point.\n\n## 💻 Contains\n- [@use-lens/cli](https://github.com/use-lens/use-lens/tree/main/packages/cli)\n- [@use-lens/react-apollo](https://github.com/use-lens/use-lens/tree/main/packages/react-apollo)\n\nSoon:\n- `@use-lens/apollo-next`\n- `@use-lens/urlq`\n\n## 🤓 Usage\n\n\u003e Works on **LTS**: https://nodejs.org/en\n\n\u003e All packages and CLI have 2 versions/dist-tags: `@testnet` and `@latest`.\n\u003e Install `@testnet` version only if you need some functionality from it(currently, it is only `createProfile`).\n\nPackage:\n\n_Detailed explanation found for each package separately._\n\n```\nnpm install @use-lens/%PACKAGE%\n```\n\n---\nCLI:\n\n_You must have a Typescript project before running it, because CLI generates *.ts files._\n\n```\nnpx @use-lens/cli generate %PACKAGE%\n```\n_or_\n```\nnpm install --save-dev @use-lens/cli\nuse-lens generate %PACKAGE%\n```\n\nExample of `@testnet`: `npm install --save-dev @use-lens/cli@testnet`\n\n### Workflow\n- decide what you want to implement\n- go to 🌿 https://docs.lens.xyz to check what query or mutation you need to use\n- import from `@use-lens/*` what you need\n  - document(query or mutation)\n  - request / response types\n  - hooks for React, services for Angular, etc.\n\nExample:\n\n![import-example-react-apollo](import-example-react-apollo.png)\n\n### Recommended use\nIf you want **to play with Lens API** - don't hesitate and install some of the `@use-lens/*` packages - it will give you all you need to start.\n\nIf you want **to have more control** - use `@use-lens/cli` to generate code locally. CLI would copy essential files that a package contains and run `graphql-codegen`.\n\nYou would be able to do more with `codegen.yml`.  \nFollow official docs of [graphql-code-generator](https://github.com/dotansimha/graphql-code-generator) to understand how it works.\n\nFind a detailed explanation in the article: [How to Generate Lens API with GraphQL Code Generator](https://blog.andriishupta.dev)\n\n## 👨‍🏫 Examples\n- [cli-testnet](https://github.com/use-lens/use-lens/tree/main/examples/cli-testnet)\n- [react-apollo](https://github.com/use-lens/use-lens/tree/main/examples/react-apollo)\n\n## ❓️ FAQ\n- What happens if Lens breaks changes and I use `@use-lens/*`?  \n  I would try to fix it ASAP, but try to do \"Emergency eject\"(described below)\n- Will you update `@use-lens/*` when Lens API is updated?  \n  Yes. But currently, Lens API doesn't have a \"release schedule\", so I would monitor it manually.\n\n### \"Emergency Eject\"\nIf something happens with some package and you need to have more control over Lens API Documents, do:\n- Remove `@use-lens/*` package\n- Run `npx @use-lens/cli generage %PACKAGE%` with the same package you had\n- Use generated code instead of the package\n- Fix errors in Schema, Queries, Mutations manually as a tmp solution.\n\nTo make this smooth, you could try to update **tsconfig.json** with \"paths\":\n\nhttps://www.typescriptlang.org/docs/handbook/module-resolution.html\n\n```json lines\n{\n  \"compilerOptions\": {\n    \"baseUrl\": \"./\",\n    \"paths\": {\n      \"@use-lens/%PACKAGE%\": [\"./src/use-lens/%PACKAGE%.ts\"]\n    }\n  }\n}\n```\n\nso you won't need to update import paths to generated code\n\nExample without **tsconfig.json** modification:\n```typescript jsx\nimport { SomethingFromLensAPI } from '../src/use-lens/%PACKAGE%'\n```\n\nExample with this simple change in **tsconfig.json**:\n```typescript jsx\nimport { StaysSame } from '@use-lens/%PACKAGE%'\n```\n\n## 🧑‍💻 Contribution\nThe contribution would be closed until there is a need.\n\n### Request improvement to Lens API Documents\nRequest improvement to Lens API Documents if you see some mismatch or room for improvement. The best way would be to request Query or Mutation changes in the api-examples repo.\nCheck the \"🤝 Lens API Documents\" section below for more information.\n\n### Request a feature\nCreate an issue of what package you want to see. Possible list would fully rely on [graphql-codegen-plugins](https://the-guild.dev/graphql/codegen/plugins).\n\n### Report an issue\nBefore reporting an issue, please check:\n- if it is reproducible on https://api.lens.dev\n- if it is a https://github.com/lens-protocol/api-examples issue wrong Query or Mutation\n- if your version is up-to-date.\n\nIf errors come from outside, I cannot fix the issue in `@use-lens`.\n\n## 🤝 Lens API Documents\nThe complete set of Lens API Documents has been taken from [api-examples](https://github.com/lens-protocol/api-examples), a repo of 🌿 Lens Protocol that shows how to use Lens API.\nThe same (or similar) queries are given as examples in Lens API docs.\n\n## 🔎 LICENSE\n\nMIT. The full license text can be found in the LICENSE file.\n\n\u003e ...The above copyright notice and this permission notice shall be included in all\ncopies or substantial portions of the Software.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fuse-lens%2Fuse-lens","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fuse-lens%2Fuse-lens","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fuse-lens%2Fuse-lens/lists"}