--- title: Build description: Learn how to build your own app via LBRY in this comprehensive guide! The future of content freedom begins with you. *patriotic music plays* --- ## Introduction Want to build something on top of LBRY? This is the place to get started. If this is your first introduction to LBRY, you should read the [Overview](./overview.md) first. If you would rather build with us, check out our [Contributing Guide](./contribute.md). There are exactly 1,000,006 app ideas that could work on the LBRY network, but it doesn't make sense for _everything_ to be built on it. ### When to Use LBRY - You want to build an application that contributes to the world's knowledge, or benefits from global, shared discovery. - You want to replace an existing centralized service related to digital content distribution with a decentralized or community-controlled one. - You want to build an application that is permissionless to interact with. - You want to further openness, freedom of information, and/or personal choice on the internet. ### When Not to Use LBRY - You want to privately distribute data or information. LBRY is designed for publishing and sharing information in an open fashion. - You want to do illegal things. Ready to get started? Let's build a [Hello Satoshi](#hello-satoshi) app. If you want to read a more general overview on application building (or you don't want to use Electron), you can jump right to [Applications 101](#applications-101). ## Hello Satoshi This section will guide you through creating a basic [Electron](https://electronjs.org) application that calls to the LBRY network and renders an image returned by the network. Electron is nice because it allows you to easily create web apps that don't rely on any centralized web servers, but you can absolutely use any tooling or language you would like. ### The Steps _These steps require [npm](https://www.npmjs.com). Learn how to install it [here](https://www.npmjs.com/get-npm)._ #### 1. Download and build the starter app [electron-starter](https://github.com/lbryio/electron-starter) is the `create-react-app` of LBRY application building. ``` git clone https://github.com/lbryio/electron-starter cd electron-starter npm install npm run dev ``` #### 2. Verify the app works Type a word into the text input and click the button to [resolve](https://lbry.tech/api/sdk#resolve) it. This performs a [[claim]] lookup, which retrieves metadata the title, thumbnail, and file type from the LBRY blockchain. Try resolving `lbry://doitlive`. #### 3. Modify the code Now that we have the metadata, let's [get](https://lbry.tech/api/sdk#get) the actual file! The code to do this is already there, just un-comment these lines in the app's [renderer/index.js](https://github.com/lbryio/electron-starter/blob/master/src/renderer/index.js) file. ```js claimData.innerText = "Loading..."; Lbry.get({ uri: `lbry://${value}` }) .then(result => { const filePath = result.download_path; const image = document.createElement("img"); image.src = filePath; imageWrapper.appendChild(image); claimData.innerText = JSON.stringify(result, null, 2); }) .catch(error => { claimData.innerText = JSON.stringify(error, null, 2); }); ``` This is the code that actually downloads a file. There are more robust ways to handle the download progress, but this will work fine for images. After you added that code back, try `get`ing `lbry://doitlive`. ### You Did It! While our Hello Satoshi app isn't much to look at, it shows how simple it is to connect to the LBRY network and download files! Unfortunately, most users will want more functionality in an app than typing into a box and looking at the JSON data returned. Let's check out how to build apps real people want to use in the next section. ## Applications 101 You can build many types of apps. Your app doesn't have to use Electron, nor does it have to be targeted at consumers, use a UI, or even fetch digital content at all! In this section, we'll look into the different types of apps you could build, and the different components needed to build anything you want. Most applications will use the [LBRY SDK](#sdk) as a way of accessing and communicating with the LBRY network. A look at the [APIs](https://lbry.tech/api/sdk) provided by the SDK will help you understand what it can and can't do. Some applications do not need to access content available on the network (e.g. a wallet-only app, or a blockchain visualizer). These applications might use [lbrycrd](#lbrycrd), the full-node blockchain daemon, or [chainquery](#chainquery), which parses blockchain data into SQL. Let's look at some specific types of applications and the basic design for each. ### Web Applications #### Full Web Applications By full web application, we mean a centrally-hosted web application that uses most or all of the suite of capabilities the LBRY protocol provides. For an example of a full web application that uses LBRY, check out the [spee.ch codebase](https://github.com/lbryio/spee.ch). To create a full web application follow the typical steps you follow to create a basic application. Then, [follow the steps to interact with the LBRY SDK](#sdk). Full web applications can may also benefit from using [chainquery](#chainquery), which provides an SQL interface to blockchain data. If your web application will utilize user accounts, a common design pattern is to simply associate user IDs with common LBRY types like files, claims, and channels. If your web application will utilize per-user funds, we recommend using the account functionality provided by the SDK to give each user an account (wallet). This will allow you to keep funds cleanly separated with a single SDK instance. That's all it takes! #### Blockchain Applications By blockchain applications, we mean applications that don't utilize the data network and digital content distribution capabilities of the LBRY protocol. For an example of a blockchain application that uses LBRY, check out the [block-explorer codebase](https://github.com/lbryio/block-explorer). Whether your blockchain application is a web application, desktop application, or a mobile application, the steps will be similar to those of full applications. In each case, you'll follow the typical steps to build a basic application. Then, if your app is reading data from the blockchain and presenting it to users, you'll want to [follow the steps for using chainquery](#chainquery). If your application needs to send funds, you'll want to [follow the steps for using lbrycrd](#lbrycrd). Note that it is also possible to move funds by using the [LBRY SDK](#sdk), but the SDK does not provide a full blockchain node, only an [[SPV]] wallet. #### Other Web Applications It is also possible to create a browser extension similar to Joule and Metamask. Generally there are two ways to do this: 1. Have the user run a local copy of the [SDK](#sdk) on their computer and send commands from the browser that interact with the user's personal wallet. 1. Run the [SDK](#sdk) on a centrally hosted server and manage keys or funds for each user. If you're doing this, you'll want to read [Full Web Applications](#full-web-applications). Going through a centralized server makes it easier on users, but comes with more responsibility to keep your user's funds secure. It also requires creating business logic on your server to associate user accounts with common types like claims and files. #### Desktop Applications Desktop applications can offer greater anonymity, better performance, and features that aren't possible with a regular web app. Regardless of the type of desktop app, you'll want to follow the steps for [using the SDK](#sdk). Once that is done you can begin building an app that allows users to be fully in control of their data. They won't have to rely on third party services keeping anything secure, and they can choose to help strengthen LBRY network through seeding. ##### Electron Apps The [official LBRY desktop app](https://github.com/lbryio/lbry-desktop) is built with Electron. It is very easy to build with, and allows web developers to easily start creating "native" desktop applications. You can use a plain html document with a `