Apps
This guide will walk you throught the process of creating and managing Apps.
Lens Apps allow you to integrate various Lens primitives, such as Feeds, Graphs, Groups, and Sponsorships, in one place. As we release more features on those areas, this page will be updated with relevant sections to help you build your app. Watch this space!
Lens Apps is an umbrella primitive within the Lens Protocol that enables you to organize and manage various aspects of your application on-chain.
Anatomy of a Lens App
A Lens App is an instance of a smart contract that allows to collate different Lens primitives under a single entity.
At broadstroke, a Lens App consists of:
Metadata: Information about the app, such as name, description, and icon.
Admins: A list of EVM addresses that can make changes to the app's configuration.
Graph: A Lens Graph used to represent the relationships between Accounts for your app. If not specified, the Lens Global Graph is used.
Feeds: One or more Lens Feeds used to store user's Posts. If not specified, the Lens Global Feed is used.
Username: The Lens Username that defines the username namespace for Accounts for your app. If not specified, the lens/* Global Username is used.
Groups: An optional list of Lens Groups that you can use to organize initiatives or projects within your app.
Sponsorship: A Lens Paymaster that you can use to sponsor transaction costs for your end-users.
Create an App
The very first step you typically want to take as a developer building on Lens is to create a Lens App.
To create an App, you need to:
Create an App Metadata object
Upload the App Metadata object onto a public URI.
Deploy the Lens App smart contract.
See the Lens Metadata Standards guide for more information on creating and hosting Metadata objects.
- TS/JS
- JSON Schema
Use the @lens-protocol/metadata package to construct a valid AppMetadata object:
Example
import { MetadataAttributeType, app } from "@lens-protocol/metadata";
const metadata = app({ name: "XYZ", tagline: "The next big thing", description: "An app to rule them all", logo: "lens://4f91cab87ab5e4f5066f878b72…", developer: "John Doe <[email protected]>", url: "https://example.com", termsOfService: "https://example.com/terms", privacyPolicy: "https://example.com/privacy", platforms: ["web", "ios", "android"],});
Then, upload the App Metadata object to a public URI.
import { uploadJson } from "./my-upload-lib";
const metadataURI = await uploadJson(metadata); // e.g., lens://4f91ca…
- GraphQL
- React
- TypeScript
You can use the createApp mutation to deploy the Lens App smart contract.
You MUST be authenticated as Builder to make this request.
Finally, handle the result as explained in the Transaction Lifecycle guide.
That's it—you now know how to create and configure a Lens App, setting the foundation for building your application on Lens.