Crossmint App
Overview
In today's web3 ecosystem, creating truly decentralized applications requires more than just smart contracts. You need decentralized storage, seamless user experiences, and simplified payment options. Unfortunately, more than 95% of all web3 dApps are deployed on centralized platforms like Vercel.
This guide will walk you through building a completely decentralized NFT minting app that leverages the power of Arweave for permanent storage and Crossmint for simplified NFT creation. You'll learn how to store NFT content permanently, create and mint NFTs, build a frontend with authentication and payment options, and deploy your application to Arweave.
By the end of this tutorial, you'll have created a fully functional dApp that allows users to:
- Log into your app easily through Crossmint's Auth
- Purchase semi-fungible tokens (SFTs) following the ERC-1155 standard
- Pay for SFTs using Crossmint with crypto or credit card
- Access your application through a human-readable ArNS domain
You'll be well versed in building fully decentralized apps with the Crossmint SDK, ArDrive SDK, and the AR.IO SDK.
Example Project
- Live Demo: https://crossmint_zerotoarweave.arweave.net
- GitHub Repository: https://github.com/ar-io/crossmint-arweave-example
Here's a quick overview of what you'll learn:
-
Storage Setup: You'll begin by storing an AI-generated image on Arweave using ArDrive.io, ensuring your NFT content is permanently preserved.
-
Collection and Template Creation: You'll create an ERC-1155 collection and template on Crossmint where your semi-fungible tokens will be minted.
-
SFT Minting: You'll use Crossmint's API to mint semi-fungible tokens from your template, following their straightforward API guide.
-
Frontend Development: You'll clone the Zero-to-Arweave starter kit, which provides a solid foundation using Vite, React, and JavaScript along with the AR.IO SDK and ArDrive SDKs.
-
Authentication Integration: You'll implement Crossmint's client-side authentication system, making it easy for users to interact with your application.
-
Payment Integration: You'll add Crossmint's embedded checkout to enable users to purchase SFTs with both crypto and credit cards.
-
Frontend Design Improvements: You'll update the frontend design to better showcase your NFTs and create a more intuitive user flow.
-
Decentralized Deployment: You'll deploy your completed frontend to Arweave, ensuring your entire application stack is decentralized and permanently accessible.
-
Domain Configuration: Finally, you'll configure your ArNS domain to point to your newly deployed application, providing users with a friendly URL to access your dApp.
Let's get into the code!
Step 1: Storage Setup
First, you'll need to store your NFT image on Arweave using ardrive.io. This step ensures that your NFT's visual content is permanently preserved on the decentralized Arweave network.
Generate an AI Image
Start by creating an AI-generated image that will become your NFT:
-
Visit ChatGPT (https://chat.openai.com/) or another AI image generation tool
-
Use a prompt to generate an interesting image for your NFT
-
Download the generated image to your local machine
-
Make sure to save it in a common format like PNG or JPG
Store the Image on ArDrive.io
Now that you have your image, store it permanently on Arweave:
-
Visit ArDrive.io and log in to your account (or create one if you're new)
-
Fund your ArDrive wallet if needed (this requires AR tokens)
-
Create a new folder for your NFT project
-
Drag and drop your AI-generated image into this folder
-
Wait for the upload to complete and for the transaction to be processed
Retrieve the Arweave Transaction ID
Once your image is successfully uploaded:
-
Click on the uploaded image in your ArDrive folder
-
Look for the "Transaction ID" or "TX ID" in the file details
-
Copy this Transaction ID - it looks something like
Abc123XYZ...
(a long alphanumeric string) -
Save this Transaction ID somewhere safe - you'll need it later when creating your NFT metadata
This Transaction ID is crucial as it's the permanent reference to your image on the Arweave network. When you create your SFT template in the next step, you'll include this ID to link the tokens to this permanently stored image.
Step 2: Collection and Template Creation
Next, you'll create an ERC-1155 collection and template using Crossmint's API. These will hold your semi-fungible tokens (SFTs).
Create a Crossmint Developer Account
-
Visit the Crossmint Staging Console to create a developer account
-
Sign in and accept the dialog to continue
-
Note that Crossmint provides two environments:
- Staging: For development and testing (what we'll use first)
- Production: For your final, live application
Get a Server-Side API Key
-
After logging in, navigate to the "Integrate" tab
-
Click on "API Keys" at the top of the page
-
In the "Server-side keys" section, click "Create new key"
-
Select the following scopes under "Minting API":
collections.create
- Required for creating a new collectionnfts.create
- Required for minting NFTsnfts.read
- Needed to read NFT information
-
Create and save this API key securely - you'll need it for our API calls
Create an ERC-1155 Collection
Let's create a collection for your semi-fungible tokens using Crossmint's API:
-
Create a new file called
createCollection.js
in your project directory -
Add the following code:
-
Replace the placeholders:
YOUR_API_KEY
with the API key you created in the previous stepYOUR_ARWEAVE_TX_ID
with your collection image's Arweave Transaction ID (optional)
-
Run the script with:
node createCollection.js
-
After a few seconds, you'll receive a response with the Collection ID - save this ID for the next steps
Create an SFT Template
Now, let's create a template within your collection from which you can mint multiple identical SFTs:
-
Create a new file called
createTemplate.js
in your project directory -
Add the following code:
-
Replace the placeholders:
YOUR_API_KEY
with your API keyYOUR_COLLECTION_ID
with the Collection ID from Step 2YOUR_TEMPLATE_ID
with the Template ID from Step 2YOUR_EMAIL_ADDRESS
with your email for testing
-
Run the script with:
node mintSFT.js
-
After a few seconds, you'll receive a response with an Action ID - save this ID for checking the minting status
Check Minting Status
Since blockchain transactions take time to confirm, you need to check the status of your mint:
- Create a new file called
checkMintStatus.js
with the following code:
-
Replace the placeholders with your API key and the Action ID from the previous step
-
Run the script with:
node checkMintStatus.js
-
Keep checking until the status field returns "success"
View Your Newly Minted SFT
Once the minting is successful, you can view your SFT by:
-
Logging into your wallet from Crossmint's staging website
-
Looking for your newly minted SFT with the Arweave-stored image
-
Verify that all the metadata appears correctly, including the image from Arweave
Congratulations! You've now successfully created a collection, defined a template, and minted an SFT with its image permanently stored on Arweave. This combination provides true decentralization for your token's content.
In the next step, you'll set up your frontend application by cloning the Zero-to-Arweave starter kit.
Step 4: Frontend Development
Now that you have your image stored on Arweave and your NFT contract deployed with Crossmint, let's set up the frontend application. You'll use the Zero-to-Arweave Starter Kit, which provides a solid foundation for building decentralized applications on Arweave.
Clone the Starter Kit
- Open your terminal and clone the starter kit repository:
Install Dependencies
- Install the required dependencies using your preferred package manager:
Configure Your Arweave Wallet
- Place your Arweave wallet file in the project root as
wallet.json
. This will be required for deploying the application later, but you'll need it now to test the app functionality.
Never commit your wallet file to version control. The starter kit includes wallet.json
in its .gitignore
file by default.
Explore the Project Structure
- Take a moment to understand the project structure:
Customize the Application
- Let's customize the application for your NFT minting project. First, update the title and description in
index.html
:
- Update the homepage in
src/pages/Home.jsx
to include information about your NFT minting application:
Start the Development Server
- Run the development server to make sure everything is working properly:
- Open your browser to the URL shown in the terminal (typically
http://localhost:5173
) to see your application.
At this point, you should see your customized frontend with the Arweave wallet integration working. The application is still missing your Crossmint integration, which you'll add in the next steps.
The Zero-to-Arweave Starter Kit provides all the necessary SDKs and configurations to work with Arweave, including:
-
Arweave Wallet Kit for wallet connections
-
AR.IO SDK for domain name management
-
Turbo SDK for efficient data uploads
In the next step, you'll add Crossmint's client-side authentication to allow users to interact with your NFT minting functionality.
Step 5: Authentication Integration
Now you need to integrate Crossmint's client-side authentication into your app. This will allow users to log in and interact with your NFT minting functionality seamlessly. Let's implement Crossmint Auth in your Zero-to-Arweave starter kit.
Create and Configure a Crossmint Project
- If you haven't already, go to the Crossmint Staging Console and log in or create an account
Get a Client-Side API Key
-
Navigate to the "Integrate" section in the left navigation bar
-
Click on the "API Keys" tab
-
In the "Client-side keys" section, click "Create new key"
-
Add your development URL as an authorized origin:
- For local development:
http://localhost:5173
(Vite's default port)
- For local development:
-
Select the following scopes:
users.create
- Required for authentication functionalityusers.read
- Needed to read user information
-
Enable "JWT Auth" by checking the box
-
Create the key and save it for the next steps
Set Up Environment Variables
- Create a
.env
file in the root of your project (or modify the existing one) and add your Crossmint API key:
Install the Crossmint SDK
- Install the Crossmint React SDK:
Create a Providers Component
- Create a new file at
src/components/CrossmintProviders.jsx
:
Update Main Application Entry Point
- Modify your
src/main.jsx
file to include the Crossmint providers:
Create an Authentication Component
- Create a new component at
src/components/AuthButton.jsx
:
Simplify the NavBar Component
- We'll create a simplified NavBar component that only includes the AuthButton:
Create a Protected Route Component
- Create a component to protect routes that require authentication at
src/components/ProtectedRoute.jsx
:
Test the Authentication Flow
- Start your development server:
-
Visit your application in the browser and test these features:
-
Sign in button should open the Crossmint authentication modal
-
After signing in, you should see your user information displayed
-
Sign out button should work correctly
-
Customization Notes
In our implementation, we made the following changes to improve the user experience:
-
Simplified the NavBar - We removed the Arweave wallet connection and ARIO SDK functionality to focus solely on Crossmint authentication, creating a cleaner interface.
-
Streamlined User Interface - The app now shows a single "Sign in with Crossmint" button in the navbar, which provides a more intuitive authentication flow.
-
Removed Redundant Components - We eliminated unused state variables and effects from the NavBar component, making the code more maintainable.
-
Enhanced Brand Identity - Changed all references to "lil dumdumz NFT" to strengthen the brand presence in the application.
With Crossmint's authentication now integrated, your users can easily sign up and log in to your decentralized NFT minting application. In the next step, you'll add the Crossmint payment button to enable users to mint NFTs directly from your application.
Step 6: Payment Integration (Crypto Payments)
For your fully decentralized NFT minting application, you've implemented a client-side approach for payment integration using Crossmint's headless API for crypto payments. This allows users to purchase NFTs directly from your application using cryptocurrency, maintaining the decentralized nature of your platform.
Environment Variables Setup
You've configured your application with the necessary environment variables:
Both the API key and collection ID are from the staging environment, ensuring compatibility between the two.
Purchase Page Implementation
You've created a Purchase.jsx
component that implements the complete crypto payment flow:
- Wallet Connection: Allows users to connect their MetaMask wallet to the application
- Order Creation: Creates an order with Crossmint's API using the connected wallet address
- Recipient Assignment: Assigns the authenticated user as the recipient of the NFT
- Payment Processing: Prompts the user to sign a transaction in their wallet
- Status Tracking: Polls the order status until completion
Here's an overview of how your Purchase component is structured:
Crypto Payment Flow
The crypto payment flow in your application follows these steps:
- Connect Wallet: User connects their MetaMask wallet to the application
- Create Order: Application creates an order with Crossmint's API
- Update Order with Recipient: Application assigns the NFT to the authenticated user
- Send Transaction: User signs and sends the transaction from their wallet
- Poll for Status: Application checks the order status until completion
User Interface Elements
Your Purchase page includes several key UI elements:
- NFT Display: Shows the NFT image and details
- Connect Wallet Button: Allows users to connect their cryptocurrency wallet
- Create Order Button: Initiates the purchase process
- Pay with Crypto Button: Appears when ready for payment
- Status Messages: Keeps users informed about the current state of their purchase
- Success/Failure Messages: Provides feedback on the outcome of the purchase
Authentication Integration
Your payment flow is integrated with Crossmint's authentication system:
- Only authenticated users can initiate the purchase process
- The user's email from their Crossmint account is used as the recipient for the NFT
- Protected routes ensure only authenticated users can access the Purchase page
App Routes Update
You've updated the application routes to include the Purchase page:
NavBar Update
You've also updated the NavBar component to include a link to the Purchase page:
Testing the Crypto Payment Flow
To test the complete purchase flow:
- Start the development server with
pnpm run dev
- Sign in with Crossmint using the AuthButton
- Navigate to the Purchase page
- Connect your MetaMask wallet to the application
- Create an order by clicking the Create Order button
- When prompted, sign the transaction in your wallet
- Monitor the order status until completion
- Verify that the NFT appears in your Crossmint wallet
Benefits of the Crypto Payment Approach
This crypto payment implementation offers several advantages:
- Fully Decentralized: The entire payment process happens client-side, aligning with your goal of a decentralized application
- Native Blockchain Experience: Users interact directly with their wallets for a true web3 experience
- No Server-Side Requirements: All API calls are made from the client, making the app compatible with Arweave deployment
- Transparent Process: Users can see and verify each step of the transaction process
- Cross-Chain Compatibility: The same approach can be used to accept payments on various blockchains
By implementing this payment flow, you've created a seamless way for users to purchase NFTs using cryptocurrency while maintaining the decentralized nature of your application. This sets the stage for the next step: deploying your complete application to Arweave.
Step 7: Frontend Design Improvements
After implementing the core functionality of your application, it's important to enhance the user interface to create a more engaging and professional experience. A well-designed UI not only improves usability but also increases user trust in your NFT platform. Let's update your frontend design to better showcase your NFTs and create a more intuitive user flow.
Redesigning the NavBar Component
First, let's enhance your NavBar with a modern design and responsive functionality:
This updated NavBar includes:
-
Modern Design Elements:
- Gradient text for the brand name
- Subtle hover and active state animations
- Clean, consistent spacing
- Sticky positioning so it remains visible while scrolling
-
Responsive Features:
- Collapsible mobile menu with toggle button
- Different layouts for mobile and desktop
- Automatic menu closing when a link is clicked
-
User Experience Improvements:
- Visual feedback for the current active page
- Conditional navigation links based on authentication status
- Accessible design with proper ARIA attributes
-
Enhanced Brand Identity:
- Consistent color scheme, typography, and styling elements
- Strengthened "lil dumdumz NFT" brand presence
-
Improved Conversion Rates:
- Strategic placement of call-to-action buttons
- Clear value propositions for the platform's benefits
Enhancing the App Layout
Next, you'll update your App.jsx to use a more structured layout that provides consistency across all pages:
The new App.jsx layout includes:
- A full-height flexible layout with a subtle gradient background
- Consistent page structure with appropriate margins and padding
- A placeholder dashboard with skeleton loading states for future NFT displays
- Proper routing with protected routes for authenticated content
Creating an Engaging Home Page
A good landing page is crucial for NFT platforms. You've redesigned your Home component to create a more engaging and informative experience:
This enhanced Home page includes several key elements:
-
Engaging Hero Section:
- A bold color gradient background with a two-column layout
- Prominent headline and subheading that clearly communicates the value proposition
- Featured NFT display with hover effects and overlay information
- Call-to-action buttons that adapt based on user authentication status
-
Features Explanation:
- Three-column layout highlighting the key benefits of the platform
- Custom icons with consistent styling
- Interactive hover effects to increase engagement
- Clear, concise descriptions of the advantages of using your platform
-
NFT Showcase Section:
- Detailed card displaying the NFT with its specifications
- Responsive design that adapts to different screen sizes
- Clear visual hierarchy with appropriate spacing
- Contextual call-to-action based on authentication state
-
Compelling Call-to-Action Section:
- Bold color background to draw attention
- Clear, benefit-focused headline
- Prominent action button to drive conversions
Design Enhancement Benefits
These frontend improvements offer several advantages for your NFT platform:
-
Increased User Engagement: The visually appealing design with interactive elements keeps users interested and encourages exploration.
-
Better User Experience: The responsive design ensures a consistent experience across all devices, while the intuitive navigation makes the platform easy to use.
-
Enhanced Brand Identity: The consistent color scheme, typography, and styling elements strengthen your "lil dumdumz NFT" brand identity.
-
Improved Conversion Rates: Strategic placement of call-to-action buttons and clear value propositions help guide users toward purchasing NFTs.
-
Accessibility Improvements: Proper contrast ratios, ARIA attributes, and semantic HTML make the platform more accessible to all users.
By implementing these design improvements, you've transformed your functional NFT platform into a visually appealing and user-friendly experience that better showcases your NFTs and encourages user interaction.
Step 8: Decentralized Deployment
Now that you have built your complete NFT minting application with Arweave storage and Crossmint integration, let's deploy it to the Arweave network. This will make your entire application permanently available and truly decentralized.
Prepare for Deployment
Before deploying, make sure you have:
-
Your Arweave wallet file (
wallet.json
) in the project root -
Sufficient AR tokens in your wallet for the deployment transaction
-
Turbo credits for fast uploads (available from turbo-topup.com)
Build the Production Version
- Build your application for production:
This will create optimized production files in the dist
directory.
Deploy to Arweave
- The starter kit comes with a pre-configured deployment script. Run it to deploy your application:
This script will:
-
Take your built application from the
dist
directory -
Upload all assets to Arweave using Turbo for faster deployment
-
Generate a manifest file that binds all your application files together
-
Provide you with a deployment URL in the format:
https://arweave.net/{manifestId}
- Once the deployment completes, you'll see output similar to:
- Important: Save this manifest ID as you'll need it for the next step.
Test Your Deployed Application
-
Visit the provided URL (
https://arweave.net/YOUR_MANIFEST_ID
) to verify your application is working correctly. -
Test all functionality:
-
Arweave wallet connection
-
Crossmint authentication
-
NFT minting with the payment button
-
Since your application is now deployed to Arweave, it will remain accessible at this URL forever! Unlike traditional web hosting, there are no recurring fees or servers to maintain.
Benefits of Arweave Deployment
By deploying to Arweave, your NFT minting application gains several advantages:
-
Permanence: The application is stored permanently on the blockchain
-
Censorship resistance: No central authority can remove your application
-
No server maintenance: No need to manage servers or renew domains
-
True decentralization: Both the app's data (NFT images) and the application itself are decentralized
In the next and final step, you'll connect your deployed application to a human-readable domain name, making it easier for users to access.
Step 9: Domain Configuration
Now that your application is deployed to Arweave, the final step is to connect it to a human-readable domain name using the Arweave Name System (ArNS). This will make your dApp easily accessible with a memorable URL.
Prerequisites
Before configuring your domain, ensure you have:
-
Successfully deployed your application to Arweave (from Step 8)
-
The manifest ID from your deployment
-
An ARNS name (purchased from arns.app)
-
$ARIO tokens for transaction fees
Purchase an ARNS Name (if needed)
-
If you don't already have an ARNS name:
-
Visit arns.app
-
Connect your Arweave wallet
-
Search for an available name
-
Purchase it with $ARIO tokens
-
Get Your Process ID
-
To update your ARNS name:
-
Visit arns.app
-
Connect your Arweave wallet
-
Click "Manage Assets" in the top-right
-
Find your ARNS name and click on the settings icon
-
Copy the Process ID displayed in the management interface
-
Update the Base Record Configuration
-
Open the
/scripts/setBaseArns.js
file in your project -
Update the
processId
in the configuration:
- Update the
dataLink
value with your deployment's manifest ID:
Set the Base Record
- Run the command to update your ARNS name with your application's manifest ID:
- The script will connect to AR.IO, submit the transaction, and update your name to point to your application. When successful, you'll see output similar to:
Optional: Configure Undernames
-
If you want to create subdomains for different parts of your application, you can set up undernames:
-
Open
/scripts/setUndername.js
-
Update the
processId
with your Process ID -
Configure the undername and data link
-
Run:
-
Verify Your Domain Configuration
-
To verify all records associated with your ARNS name:
-
Open
/scripts/getRecords.js
-
Update the
processId
with your Process ID -
Run:
-
- This will display all the records for your ARNS name, including the base record that should now point to your application.
Access Your Application
-
Your application is now accessible at:
https://YOUR-NAME.ar.io
-
Share this user-friendly URL with your users - they can now access your fully decentralized NFT minting application using a memorable domain name.
Important Notes
-
ARNS name record updates may take a few minutes to propagate through the network
-
The default TTL (Time-to-Live) for name records is 15 minutes
-
If users experience issues accessing your domain, they can always use the direct Arweave URL:
https://arweave.net/YOUR_MANIFEST_ID
Congratulations! 🎉 You've successfully built and deployed a fully decentralized NFT minting application that:
-
Stores NFT images permanently on Arweave
-
Mints NFTs on Ethereum using Crossmint
-
Provides seamless authentication for users
-
Offers multiple payment options for NFT purchases
-
Is deployed in a truly decentralized manner on Arweave
-
Is accessible via a human-readable domain name
Your application represents the future of Web3: decentralized storage, simplified user experiences, and permanent availability. Users can now mint NFTs with confidence, knowing that their digital assets will truly last forever on the permaweb supported by the permanent cloud solution, AR.IO.
Conclusion
Congratulations! You've successfully built an end-to-end decentralized NFT minting application that combines the permanent storage capabilities of Arweave with the user-friendly minting experience of Crossmint. This powerful combination creates a truly decentralized application that overcomes many of the traditional barriers to NFT adoption.
What You've Accomplished
In this tutorial, you've:
-
Stored Content Permanently - Used ArDrive.io to store your NFT images on Arweave, ensuring they'll remain accessible forever
-
Simplified NFT Creation - Integrated Crossmint's SDK to mint NFTs without requiring users to understand complex blockchain interactions
-
Built a User-Friendly Frontend - Created a React application with wallet connection and authentication
-
Added Payment Options - Implemented Crossmint's payment button to allow purchases with credit cards and cryptocurrencies
-
Deployed Decentrally - Published your entire application to Arweave, ensuring it will remain available indefinitely
-
Created a Memorable Address - Connected your application to a human-readable domain name
The Power of This Approach
This architecture solves several key problems in the NFT space:
-
True Permanence: Unlike NFTs that reference assets on centralized servers, your NFT images are stored permanently on Arweave
-
Accessibility: By offering credit card payments, you've made NFTs accessible to mainstream users
-
Complete Decentralization: Both your application and your assets are stored on decentralized networks
-
User-Friendly Experience: The combination of Arweave and Crossmint creates a seamless experience for both creators and collectors
Next Steps
To continue building on this foundation, consider:
-
Adding a gallery feature to display owned NFTs
-
Implementing NFT rarity traits and metadata
-
Creating a multi-creator marketplace
-
Adding social features like comments or likes
-
Building analytics to track sales and engagement
Resources
For more information on the technologies you've used:
By combining these powerful tools, you've built an application that represents the best of what Web3 has to offer: true ownership, permanence, permissionlessness, and accessibility. Your users can now mint NFTs with confidence, knowing that their digital assets will truly last forever on the permaweb supported by the permanent cloud solution, AR.IO.