Guides

Metadata Standards

The Lens Protocol Metadata Standards

The Lens Protocol Metadata Standards is a specification for describing Lens metadata objects. It is designed to be used by builders to describe the Lens publications and profiles created via their applications.

Self-describing standard

The Lens Protocol Metadata Standards is a self-describing metadata specification. This means that the metadata itself contains a reference to the schema that describes it. This enables the metadata to evolve over time without breaking existing applications.

The Lens Protocol Metadata Standards can be seen as a cohesive collection of different standards. There's standards for publications, mirrors, and profiles metadata.

The LIP-2 Metadata Standards for Lens sets the foundation for the first iteration of this new metadata standard approach. The idea is that the community can expand and evolve such specification to cover their needs.

Each standard in the collection can evolve independently and at different speed from the others. New standard can be added as well to cover new scenarios.

The standard is encapsulated in a living specification Lens Protocol Metadata Standards repository.

The repository is home to:

  • JSON Schemas - to verify in a platform independent way the conformity of a given metadata JSON file.
  • Validation and parsing tools - to verify and process a metadata object
  • Builders and helpers - to support the process of creating compliant metadata objects

Getting started

The @lens-protocol/metadata package is the quickest way to get started using the new standard and tools.

To install the package run:

npm i zod @lens-protocol/metadata@latest
yarn add zod @lens-protocol/metadata@latest
pnpm add zod @lens-protocol/metadata@latest

The package contains:

  • Parsing tools
  • Builder helpers
  • JSON Schemas
  • TypeScript types in support of the above

If you use it in your client-side code, the maximum bundle size impact is ~11KB gzip (~20ms download time on average 4G). The library is fully tree-shakeable. The vast majority of integrators will use a subset of the given features, so the concrete impact on the final bundle size is even less.

The package has an optional peer dependency on zod. If all you need is the JSON Schemas you can safely omit zod.

Useful links