Create an App

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


To create an App, you need to:

  1. Create an App Metadata object

  2. Upload the App Metadata object onto a public URI.

  3. Deploy the Lens App smart contract.

See the Lens Metadata Standards guide for more information on creating and hosting Metadata objects.

1

Create App Metadata

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

Then, 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…

3

Deploy App Contract

You MUST be authenticated as Builder to make this request.

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

import { createApp, fetchApp } from "@lens-protocol/client/actions";import { handleWith } from "@lens-protocol/client/viem";
import { walletClient } from "./viem";
// …
const result = await createApp(sessionClient, {  metadataUri: uri, // the URI from the previous step})  .andThen(handleWith(walletClient))  .andThen(sessionClient.waitForTransaction)  .andThen((txHash) => fetchApp(sessionClient, { txHash }));
if (result.isErr()) {  return console.error(result.error);}
const app = result.value; // the deployed app

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