Metaplex
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 here.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:
Create a
.env
file inpackages/web
.Set
REACT_APP_STORE_OWNER_ADDRESS_ADDRESS
to your wallet's public address.
Example:
Creating Your Store
After setting up your store ID, you can create your store using Metaplex's helper methods.
Steps:
Use the
saveAdmin
method located atpackages/web/src/actions/saveAdmin
.You can create a script or a button in your UI to call this method.
Example:
For a button in your UI:
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:
Replace https://github.com/metaplex-foundation/metaplex
with your repository URL, and set ASSET_PREFIX
to your repository name.
Example:
Step 2: Deploy
Navigate to the js/packages/web
directory and run the following command:
Note: If you have 2FA enabled, you'll need to use a personal access token as your password. Follow this guide for more details.
Deploying with a Custom Domain
If using a custom domain, remove the ASSET_PREFIX
from the deploy script:
Deploy using the same commands as above.
Deploying to Vercel
To deploy your store to Vercel:
Visit Vercel and create a new project linked to your GitHub repo.
Create a
pages/
directory underjs
.Configure the project with the following settings:
Framework: Next.js
Root directory:
js
Output directory:
packages/web/.next
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
In the
Dockerfile
, setENV REACT_APP_STORE_OWNER_ADDRESS_ADDRESS=""
to your wallet address.In
js/packages/web/.env.production
, setREACT_APP_STORE_OWNER_ADDRESS_ADDRESS
to your wallet address.Build your Docker image using:
Upload your image using
gcloud cli
. Refer to this guide.
Step 2: Create Cloud Run Services
Visit Cloud Run and create a new service.
Set up your service name (e.g.,
my nft store
) and choose your uploaded image.In the advanced settings, add the following environment variable:
Name:
NODE_ENV
Value:
production
Step 3: Set Up Your Domain
Visit the "Manage Custom Domain" section in Cloud Run.
Set up your domain and bind it to the service.
Last updated