{"id":14483686,"url":"https://github.com/textileio/js-examples","last_synced_at":"2025-07-27T12:10:58.784Z","repository":{"id":45778862,"uuid":"257404606","full_name":"textileio/js-examples","owner":"textileio","description":"Examples and demos using Textile's Javascript/Typescript libraries and clients.","archived":false,"fork":false,"pushed_at":"2021-05-07T13:12:09.000Z","size":2436,"stargazers_count":60,"open_issues_count":3,"forks_count":29,"subscribers_count":5,"default_branch":"master","last_synced_at":"2024-09-04T00:06:40.744Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"TypeScript","has_issues":false,"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/textileio.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2020-04-20T21:10:37.000Z","updated_at":"2022-11-12T23:11:59.000Z","dependencies_parsed_at":"2022-09-24T14:12:35.518Z","dependency_job_id":null,"html_url":"https://github.com/textileio/js-examples","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/textileio%2Fjs-examples","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/textileio%2Fjs-examples/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/textileio%2Fjs-examples/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/textileio%2Fjs-examples/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/textileio","download_url":"https://codeload.github.com/textileio/js-examples/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":227673973,"owners_count":17802303,"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-09-03T00:01:59.544Z","updated_at":"2024-12-02T05:15:16.892Z","avatar_url":"https://github.com/textileio.png","language":"TypeScript","funding_links":[],"categories":["TypeScript"],"sub_categories":[],"readme":"# js-examples\n\nAll code here is used as reference in the main documentation page, [docs.textile.io](https://docs.textile.io).\n\n## Issues \u0026 Support\n\nPlease open all issues on [textileio/js-textile](https://github.com/textileio/js-textile/issues) and the name or link to the specific example you are debugging.\n\n## Use\n\nYou can find each stand-alone example in each of the subdirectories.\n\n**Note**\n\nThe chat demo, hub-threaddb-chat, has been temporarily deprecated until we complete the [threads refactor](https://github.com/textileio/js-threads/issues/414) project.\n\n\u003e Examples and demos using Textile's Javascript/Typescript libraries and clients.\n\n### bucket-photo-gallery - setup user buckets to hold files\n\nThis example users non-signing keys for development mode. Here, you'll create a new user and then give them an interface to upload files to their own bucket.\n\nYou can read about key generation here: https://docs.textile.io/hub/apis/.\n\nNext, you will need to update the example to use your Hub API key, https://github.com/textileio/js-examples/blob/master/bucket-photo-gallery/src/App.tsx#L19.\n\nNote: you will want to use a signing key if you use this example for a production application. Read more about that process here, https://docs.textile.io/tutorials/hub/production-auth/.\n\n#### Build \u0026 serve\n\nChange directories into the `bucket-photo-galleries` repo.\n\n```bash\nnpm run start\n```\n\nYour browser should automatically launch to the app running on [localhost:3001](http://localhost:3001).\n\n### hub-browser-auth-app - shows the full client/server setup to using signed api keys\n\nThis example includes two Typescript projects. A server in `src/server` and a client in `src/client`. The example demonstrates how to use the [Textile Hub](https://docs.textile.io/) APIs from the Browser using user identities and **user group keys**.\n\nRead the full tutorial accompanying this example on [docs.textile.io](https://docs.textile.io).\n\nTo run, you need to first copy the `example.env` folder to `.env`. Next, you need to update the key and secret fields with values you create using the Hub CLI.\n\n#### WARNING\n\n_Do not share any API Key Secrets. This includes User Group Key secret and Account key Secrets. Be sure you never commit them into public repos or share them in published apps._\n\n#### Configure\n\nCreate a `.env` file in the root of your project. Ensure you never check this file into your repo or share it, it contains your User Group Key Secret.\n\n```bash\ncp example.env .env\n```\n\nThen replace the `USER_API_KEY` and `USER_API_SECRET` values with those you create using the Textile Hub and your own account or org (see [docs.textile.io](https://docs.textile.io) for details).\n\n#### Setup\n\n```bash\nnpm install\n```\n\n#### Clean\n\n```bash\nnpm run clean\n```\n\n#### Run basic auth client\n\nIn this example, you can see how to create a basic user auth flow:\n\n* the user is defined by a simple keypair created in the browser on demand.\n* the user is then granted access to the developer's hub resources through the use of API keys.\n* the user can then access their own thread APIs to begin creating threads and buckets.\n\nThe client code is available in `src/basic`.\n\n#### Build \u0026 serve\n\nYou can run the server and client in development mode by opening two terminal windows. \n\n**Terminal 1: watch the client code**\n\n```bash\nnpm run dev:client\n```\n\n**Terminal 2: start the dev server**\n\n```bash\nnpm run start:server\n```\n\nYou can now view the example at [localhost:3001](http://localhost:3001).\n\n\n\n### user-mailbox-setup - demonstrates how to setup the user mailbox api\n\nThis example uses a hard-coded PrivateKey as your first user's identity. It then uses the User API to enable the user's mailbox. Instead of setting up a second user, it will just send messages from the user to themselves.\n\nTo use this example, you must create a Hub API key and update the code to use it.\n\n### react-native-hub-app - demonstrates both bucket and thread functionality in react native\n\nLike many of the examples, start by copying `example.env` to `.env` and filling our key and secret values from your own Hub account.\n\nThe example, when run, will go through a series of examples that set up user identity, threads, and then buckets with the Textile Hub.\n\n### metamask-identities-ed25519 - a password based privatekey generation workflow for textile identities\n\nThis example will use a user's Ethereum address and signing API from Metamask to create a new ed25519 private key identity. It does this in combination with a user supplied password. Your app never needs to store the password or private key, as the user can regenerate them at any time.\n\nYou can use the identity created with any example above, your own apps, and with any Textile API for your user identities.\n\n### 3box-identities-ed25519\n\nSimilar to the above example, this example uses 3Box to derive the private key based on the user's ethereum account. It uses the box api to store the private key value on 3Box's server so it can be fetched at a future time.\n\nYou can use the identity created with any example above, your own apps, and with any Textile API for your user identities.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftextileio%2Fjs-examples","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Ftextileio%2Fjs-examples","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftextileio%2Fjs-examples/lists"}