{"id":20049013,"url":"https://github.com/unlock-protocol/react-example","last_synced_at":"2025-06-28T14:34:03.867Z","repository":{"id":44147028,"uuid":"196276530","full_name":"unlock-protocol/react-example","owner":"unlock-protocol","description":"An example of how to integrate Unlock inside any React application","archived":false,"fork":false,"pushed_at":"2022-07-08T18:09:30.000Z","size":409,"stargazers_count":14,"open_issues_count":4,"forks_count":36,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-04-08T21:41:24.790Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"JavaScript","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/unlock-protocol.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}},"created_at":"2019-07-10T21:21:15.000Z","updated_at":"2024-05-07T13:00:34.000Z","dependencies_parsed_at":"2022-09-02T16:35:59.341Z","dependency_job_id":null,"html_url":"https://github.com/unlock-protocol/react-example","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/unlock-protocol%2Freact-example","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/unlock-protocol%2Freact-example/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/unlock-protocol%2Freact-example/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/unlock-protocol%2Freact-example/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/unlock-protocol","download_url":"https://codeload.github.com/unlock-protocol/react-example/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":252480533,"owners_count":21754787,"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-11-13T11:47:58.407Z","updated_at":"2025-05-05T10:31:46.954Z","avatar_url":"https://github.com/unlock-protocol.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Getting Started\n\nThis project was bootstrapped with [Create React App](https://github.com/facebook/create-react-app) and was extended to utilize the [Unlock Paywall](https://docs.unlock-protocol.com/tools/paywall/).\n\nIf this is the first time you have been introduced to [Unlock Protocol](https://unlock-protocol.com/) and you are an experienced developer then we suggest you start by dropping into the [Unlock Protocol Docs](https://docs.unlock-protocol.com/). We have less technical [Guides](https://unlock-protocol.com/guides/) which are geared more towards creators or people with less experience doing web development.\n\n## Find Support\n\n[Unlock Protocol Discord server](https://discord.com/invite/Ah6ZEJyTDp) is the best place to ask for support and technical questions are best asked in the developer channel where you'll find both Unlock Protocol core team members and community members ready to help you through whatever issues you may be having. In general you'll want to join us there for protocol updates, governance information and to connect with the greater Unlock Protocol ecosystem.\n\n## Before configuration\nBefore you get started configuring your app you'll need a few important items.\n\n### Deploying a Lock\nYou will need to deploy your own lock to use in the configuration below. If you haven't done that yet you can use the [Unlock Dashboard](https://app.unlock-protocol.com/dashboard). Documentation on how to deploy a lock via the dashboard can be found [here](https://docs.unlock-protocol.com/basics/deploying-a-lock). The current configuration file is preloaded with the Unlock Member lock so it will work out of the box but won't be very useful to you until you complete your lock deployment and update the configuration file.\n\n### Unlock Accounts \u0026 Credit Cards\n\nWe understand with web3 not everyone is there yet and making it easier for users to get started is really the goal so your users don't have to be crypto native. For users of your app who may not have their own crypto wallet yet we've made it easy to create special [Unlock Accounts](https://docs.unlock-protocol.com/basics/unlock-accounts) and [enable payments via credit card](https://unlock-protocol.com/guides/enabling-credit-cards/).\n\n## Unlock Specific Configuration\n\n### Unlock Paywall\nCurrently the app utilizes the latest version of the [Unlock Paywall](https://docs.unlock-protocol.com/tools/paywall/) but you only need to change the link in the index.html to specify a specific version if that is what you need. We are dedicated to pushing breaking changes to a new url for the [Unlock Paywall](https://docs.unlock-protocol.com/tools/paywall/) so you shouldn't fear leaving it on latest.\n\nIn the public/index.html you will find an Unlock configuration object.\n\n```JavaScript\n\u003c!-- Unlock Configuration --\u003e\n\u003cscript\u003e\n  var unlockProtocolConfig = {\n      \"network\": 100, // Network ID (1 is for mainnet, 4 for rinkeby, 100 for xDai, etc)\n      \"locks\": {\n        \"0xac1fceC2e4064CCd83ac8C9B0c9B8d944AB0D246\": {\n          \"name\": \"Unlock Members\"\n        }\n      },\n      \"icon\": \"https://unlock-protocol.com/static/images/svg/unlock-word-mark.svg\",\n      \"callToAction\": {\n        \"default\": \"Please unlock this demo!\"\n      }\n    }\n\u003c/script\u003e\n```\n\nThere are many different configuration options for the [Unlock Paywall](https://docs.unlock-protocol.com/tools/paywall/) and the complete documentation for those options can be found [here](https://docs.unlock-protocol.com/tools/paywall/configuring-checkout/).\n\n### Unlock Event Listeners\n\nYou'll find we've added special event listeners in the src/App.js file. This is a very basic example which changes the visible content on a page when a user finishes the checkout or already has a key in their wallet and the state changes from \"locked\" to \"unlocked\".\n\n## Deploying the app\n\nNow that we've gone over the Unlock specific changes and configurations you should be ready to get started. In the project directory, you can run:\n\n### `npm start`\n\nRuns the app in the development mode.\u003cbr\u003e\nOpen [http://localhost:3000](http://localhost:3000) to view it in the browser.\n\nThe page will reload if you make edits.\u003cbr\u003e\nYou will also see any lint errors in the console.\n\n### `npm test`\n\nLaunches the test runner in the interactive watch mode.\u003cbr\u003e\nSee the section about [running tests](https://facebook.github.io/create-react-app/docs/running-tests) for more information.\n\n### `npm run build`\n\nBuilds the app for production to the `build` folder.\u003cbr\u003e\nIt correctly bundles React in production mode and optimizes the build for the best performance.\n\nThe build is minified and the filenames include the hashes.\u003cbr\u003e\nYour app is ready to be deployed!\n\nSee the section about [deployment](https://facebook.github.io/create-react-app/docs/deployment) for more information.\n\n### `npm run eject`\n\n**Note: this is a one-way operation. Once you `eject`, you can’t go back!**\n\nIf you aren’t satisfied with the build tool and configuration choices, you can `eject` at any time. This command will remove the single build dependency from your project.\n\nInstead, it will copy all the configuration files and the transitive dependencies (Webpack, Babel, ESLint, etc) right into your project so you have full control over them. All of the commands except `eject` will still work, but they will point to the copied scripts so you can tweak them. At this point you’re on your own.\n\nYou don’t have to ever use `eject`. The curated feature set is suitable for small and middle deployments, and you shouldn’t feel obligated to use this feature. However we understand that this tool wouldn’t be useful if you couldn’t customize it when you are ready for it.\n\n## Learn More\n\nYou can learn more in the [Create React App documentation](https://facebook.github.io/create-react-app/docs/getting-started).\n\nTo learn React, check out the [React documentation](https://reactjs.org/).\n\n### Code Splitting\n\nThis section has moved here: https://facebook.github.io/create-react-app/docs/code-splitting\n\n### Analyzing the Bundle Size\n\nThis section has moved here: https://facebook.github.io/create-react-app/docs/analyzing-the-bundle-size\n\n### Making a Progressive Web App\n\nThis section has moved here: https://facebook.github.io/create-react-app/docs/making-a-progressive-web-app\n\n### Advanced Configuration\n\nThis section has moved here: https://facebook.github.io/create-react-app/docs/advanced-configuration\n\n### Deployment\n\nThis section has moved here: https://facebook.github.io/create-react-app/docs/deployment\n\n### `npm run build` fails to minify\n\nThis section has moved here: https://facebook.github.io/create-react-app/docs/troubleshooting#npm-run-build-fails-to-minify\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Funlock-protocol%2Freact-example","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Funlock-protocol%2Freact-example","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Funlock-protocol%2Freact-example/lists"}