Help & Support

Create an App

This guide will walk you through the process of creating a Lens App.

To create an App, follow these steps.

You MUST be authenticated as Builder create an App.

1

Create App Metadata

First, construct an App Metadata object with the necessary content.

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"],});

2

Upload App Metadata

Next, upload the App Metadata object to a public URI.

import { storageClient } from "./storage-client";
const { uri } = await storageClient.uploadAsJson(metadata);
console.log(uri); // e.g., lens://4f91ca…

This example uses Lens Storage to host the Metadata object. See the Lens Metadata Standards guide for more information on hosting Metadata objects.

3

Deploy App Contract

Next, deploy the Lens App smart contract.

Use the createApp action to deploy the Lens App smart contract.

import { uri } from "@lens-protocol/client";import { createApp } from "@lens-protocol/client/actions";
// …
const result = await createApp(sessionClient, {  metadataUri: uri("lens://4f91…"), // the URI from the previous step  defaultFeed: {    globalFeed: true,  },  graph: {    globalGraph: true,  },  namespace: {    globalNamespace: true,  },});

4

Handle Result

Finally, handle the result using the adapter for the library of your choice:

import { handleOperationWith } from "@lens-protocol/client/viem";
// …
const result = await createApp(sessionClient, {  metadataUri: uri("lens://4f91…"), // the URI from the previous step}).andThen(handleOperationWith(walletClient));

See the Transaction Lifecycle guide for more information on how to determine the status of the transaction.

That's it—you now can start using your Lens App!