Stacks NFTs, Ordinals and Stamps · one shared collectibles service · extension and mobile
Shared NFT gallery and token details for a Bitcoin wallet.
Built the shared token details and NFT gallery features that the Leather extension and mobile app both use, on top of a features package in the monorepo.
View source on GitHubOverview
Leather’s browser extension and mobile app each had their own code for activity, collectibles and token details. I built the shared token details and NFT gallery features that both apps now use. That included TypeScript and Node.js backend-for-frontend (BFF) services that combine blockchain data with third-party API data.
This case study covers how the shared code was introduced and how the collectibles and token details work was built on top of it.
For the monorepo and the mobile app, see the Leather Mobile case study.
The problem
The extension and the mobile app duplicated the same logic. A fix to collectibles in one app did not reach the other. The two apps drifted.
The collectibles themselves come from different places. Stacks NFTs, Bitcoin Ordinals inscriptions and Stamps each have their own data source and shape. Without a shared model, every screen would need a branch per source.
What I built
Chapter 1: Shared features behind a flag
I moved shared behaviour into a features package in the monorepo, using branch by abstraction: the new code sat behind a flag next to the old code until it was ready. Activity moved first, with shared queries. I later split one flag into four, so the team could see what had merged and work on the rest in parallel.
Chapter 2: Collectibles and token details
On mobile I built token details and the collectibles home widget. On the extension I moved collectibles to the shared service, removed the legacy code, and added token details, collectible details screens and empty states. I also extended the shared collectibles service with Stamps, and added an E2E test for sending an inscription.
A shared CollectibleView type and type guards are the contract. Both apps render the same data shape.
Outcome
The extension and mobile app now share one collectibles service and one data model. Stacks NFTs, Ordinals inscriptions and Stamps go through the same code path. A fix to collectibles now reaches both apps at once.
Outcome
- 2
- Apps sharing one collectibles service: extension and mobile
- 3
- Collectible sources in one data model: Stacks NFTs, Ordinals and Stamps