SoLibrary
  • Solana
  • The Meme Coin Problem and Solution
  • Developing on Solana
  • From Rust To Deployment
  • Solana Blockchain Explorer
  • Building a Solana dAPP
  • Deploying a Solana dApp
  • Deploying a Solana Memecoin using CLI
  • Solana Smart Contracts
  • Send Solana via javascript functions
  • Candy Machine
  • Pump fun APIs
  • Metaplex
  • Metaplex Program Library
  • Solana Program Library
  • UMI Framework
  • Umi and Web3js Differences
  • Fetching Accounts
  • UMI Helpers
  • HTTP Requests
  • Umi's Interfaces
  • Interface implementations
  • Kinobi
  • UMI Plugins
  • Registering Programs
  • Public keys and Signers
  • Connecting RPCS
  • Serializer
  • Storage
  • Transactions
  • Web 3.JS Adapters
  • Metaplex Umi Plugins
  • Core JS SDK v1.0
  • Local Validator
  • SolScriptions
  • FAQ
  • Initialize
  • Write Inscription Data
  • Fetch
  • Clear
  • Close
  • Authority
  • Sharding
  • Getting Started using JavaScript
  • Getting started using the Inscriptions CLI
  • Core Candy Machine
  • Getting Started using JavaScript
  • Candy Guard
  • Assets
  • Creating a Core Candy Machine
  • Inserting Items
  • Updating The Core Candy Machine
  • Guard Groups
  • Special Guard Instructions
  • Fetching a Core Candy Machine
  • Minting
  • Withdrawing a Core Candy Machine
  • Address Gate Guard
  • Allocation
  • Allowlist Guard
  • Asset Burn Guard
  • Asset Burn Multi
  • Asset Payment Guard
  • Asset Payment Multi
  • Asset Mint Limit
  • Bot Tax Guard
  • End Date Guard
  • Edition
  • Freeze Sol Payment guard
  • Freeze Token Payment Guard
  • Gatekeeper Guard
  • Mint Limit Guard
  • NFT Burn Guard
  • NFT Gate Guard
  • NFT Mint Limit Guard
  • NFT Payment Guard
  • Program Gate Guard
  • Redeemed Amount Guard
  • Sol Fixed Fee Guard
  • Sol Payment Guard
  • Start Date Guard
  • Third Party Signer Guard
  • Token Burn Guard
  • Token Gate Guard
  • Token Payment Guard
  • Token2022 Payment Guard
  • Generating Custom Guard Client for Core Candy Machine
Powered by GitBook
On this page
  • Metaplex Storefront Guide
  • Prerequisites
  • Getting Started
  • Deploying Your Store
  • Deploying to GitHub Pages
  • Deploying to Vercel
  • Deploying to Google Cloud Run

Metaplex

PreviousPump fun APIsNextMetaplex Program Library

Last updated 10 months ago

Metaplex Storefront Guide

This guide will walk you through creating and deploying a storefront using the Metaplex platform.

Prerequisites

Before starting, ensure you have:

  • A basic understanding of React concepts such as hooks. Refer to the React documentation .

  • A wallet containing tokens to perform your transactions.

  • Familiarity with the different packages and their purposes (helpful but not required).

Getting Started

Setting Up the Store ID

To create a store, you first need to derive the store ID using your public wallet address. The Metaplex developers have provided an environment variable for this purpose: REACT_APP_STORE_OWNER_ADDRESS_ADDRESS.

Steps:

  1. Create a .env file in packages/web.

  2. Set REACT_APP_STORE_OWNER_ADDRESS_ADDRESS to your wallet's public address.

Example:

bashCopy codeREACT_APP_STORE_OWNER_ADDRESS_ADDRESS=YOUR_PUBLIC_WALLET_ADDRESS

Creating Your Store

After setting up your store ID, you can create your store using Metaplex's helper methods.

Steps:

  1. Use the saveAdmin method located at packages/web/src/actions/saveAdmin.

  2. You can create a script or a button in your UI to call this method.

Example:

jsCopy codesaveAdmin(connection, wallet, false, [])

For a button in your UI:

jsCopy code// Hooks to insert at the top of the component
const { wallet } = useWallet();
const connection = useConnection();

// The button
<Button onClick={async () => {
        try {
          await saveAdmin(connection, wallet, false, [])
        } catch (e) {
          console.error(e);
        }
}}>CREATE STORE</Button>

Note: Confirm your transactions after clicking the button. Do not navigate away from the page during this process.

Adding Your Information

After creating your store, update your store's information by editing the userNames.json file located at packages/web/src/config/userNames.json. Follow the format used by other objects in this file.

Accessing the Admin Panel

Once your store is set up, you can access the admin panel at YOUR_URL/#/admin. Here, you can manage your store, add whitelisted creators, or make your store public. Ensure you save your changes after editing.


Deploying Your Store

Deploying to GitHub Pages

Step 1: Specify Your Repository

In the js/packages/web/package.json file, update the following lines:

jsonCopy code"deploy:gh": "yarn export && gh-pages -d ../../build/web --repo https://github.com/metaplex-foundation/metaplex -t true",
"deploy": "cross-env ASSET_PREFIX=/metaplex/ yarn build && yarn deploy:gh",

Replace https://github.com/metaplex-foundation/metaplex with your repository URL, and set ASSET_PREFIX to your repository name.

Example:

jsonCopy code"deploy:gh": "yarn export && gh-pages -d ../../build/web --repo https://github.com/my-name/my-metaplex -t true",
"deploy": "cross-env ASSET_PREFIX=/my-metaplex/ yarn build && yarn deploy:gh",

Step 2: Deploy

Navigate to the js/packages/web directory and run the following command:

bashCopy codeyarn deploy

Deploying with a Custom Domain

If using a custom domain, remove the ASSET_PREFIX from the deploy script:

jsonCopy code"deploy:gh": "yarn export -d ../../build/web --repo https://github.com/my-name/my-metaplex -t true"
"deploy": "yarn build && yarn deploy:gh",

Deploy using the same commands as above.

Deploying to Vercel

To deploy your store to Vercel:

  1. Create a pages/ directory under js.

  2. Configure the project with the following settings:

    • Framework: Next.js

    • Root directory: js

    • Output directory: packages/web/.next

  3. Add REACT_APP_STORE_OWNER_ADDRESS_ADDRESS in the Environment Variables section.

Deploying to Google Cloud Run

To deploy through Google Cloud Run:

Step 1: Prepare Your Docker Container

  1. In the Dockerfile, set ENV REACT_APP_STORE_OWNER_ADDRESS_ADDRESS="" to your wallet address.

  2. In js/packages/web/.env.production, set REACT_APP_STORE_OWNER_ADDRESS_ADDRESS to your wallet address.

  3. Build your Docker image using:

    bashCopy codedocker build . -t your-image-name

Step 2: Create Cloud Run Services

  1. Set up your service name (e.g., my nft store) and choose your uploaded image.

  2. In the advanced settings, add the following environment variable:

    • Name: NODE_ENV

    • Value: production

Step 3: Set Up Your Domain

  1. Visit the "Manage Custom Domain" section in Cloud Run.

  2. Set up your domain and bind it to the service.


Note: If you have 2FA enabled, you'll need to use a personal access token as your password. Follow for more details.

Visit and create a new project linked to your GitHub repo.

Upload your image using gcloud cli. Refer to .

Visit and create a new service.

here
this guide
Vercel
this guide
Cloud Run