kevinfaveri / solana-candy-factory

Solana blockchain candy machine app boilerplate on top of Metaplex Candy Machine. NextJS, Tailwind, Anchor, SolanaLabs.React, dev/mainnet automation scripts.
MIT License
286 stars 934 forks source link

Hey, this repo is now completely outdated as it only implements the Candy Machine V1 (which has been desactivated by Metaplex)! Feel free to send a PR for supporting CM2 OR use the example app in the Metaplex official repo


Solana NFT Candy Factory

Read this if you are coming from the Quicknode guide

Currently, this repo has been reworked to represent its new goals. However, we still have some major guides in the ecosystem using the old version as reference. So, I've created a new branch from before the rework if you want to use: https://github.com/kevinfaveri/solana-candy-factory/tree/old_repo

I'm brainstorming a few ideas at IDEAS and PROGRAM IDEAS if you want to collaborate.

NOTE: This repo will prob only work on unix-based environments.

The NFT Candy Factory project is designed to let users fork, customize, and deploy their own candy machine mint app to a custom domain, ultra fast.

A candy machine is an on-chain Solana program for managing fair mint. Fair mints:

It builds on top of the the work started at https://github.com/exiled-apes/candy-machine-mint, abstracting away a few things (like having one-command shortcuts in the package.json that instantly setups dev env), improving DX and adding new tools for managing the source files. It also features some other features:

Techwise, it builds on top of NextJS and TailwindCSS for the frontend (as well as Solana Labs toolchain and Serum Anchor libs for interacting with the Solana network); and Metaplex and Solana clis for deployment on the Solana network.

Getting Set Up

Prerequisites

Advanced Features

ReCaptcha

For adding support for recaptcha just add the NEXT_PUBLIC_RECAPTCHA_KEY (client key) and RECAPTCHA_SECRET (server secret key) keys to your .env file in which the value will be your recaptcha client side key. You can generate them using your Google account: https://www.google.com/recaptcha/about/

If you do not want to use ReCaptcha, then just use a plain button and not the ReCaptcha button component.

Devnnet

In the project root directory, you can run:

Note: You will still need to generate NFT sources and place in the 'nft-sources' folder. There are a few examples in this repository. They should always start with 0.json and 0.png.

ALERT: Running this command will replace your Solana devwallet generated before at ~/.config/solana/candyfactory-devnet.json as well as all previous environment stuff you had, like your .env.local. It is a nuke solution for resetting development environment. The source scripts are available in the devtools folder in the root of the project. So, if something goes wrong, go into this folder and try running each command a time.

After your Devnnet candy machine has been created feel free to run:

Mainnet

For deploying your collection on the mainnet just run yarn deploy-mainnet and answer the questions as prompted. It will store your wallet key in our path: ~/.config/solana/candyfactory-mainnet.json (if you want to edit that just tweak setup-solana-mainnet.sh). It is the same process as used for the development environment but asking for importing a Wallet PK (that should have enough SOLs and will be the one that will receive the mint value).

After the deployment is over, it will generate all envs that your frontend dApp needs in a file called .env.local.production in the root of the project. These env values should then be added as environment variables where you build your dAapp (if Vercel, you need to add to their ENVIROMENT VARIABLES config section).

Donate

The best way to support me is by following me on https://twitter.com/kevcode_art and https://twitter.com/aiphotos_ (which is the art project that inspired this repository) :)

Others Tools

If you want multisig wallets, you may study https://github.com/GokiProtocol/goki or the https://github.com/project-serum/multisig.

A ton of other useful tools/repos: https://github.com/HashLips/hashlips_art_engine

https://github.com/exiled-apes/candy-machine-mint

https://github.com/InnerMindDAO/MintUI (GUI for the Candy Machine)

https://github.com/theskeletoncrew/treat-toolbox (WebApp for creating collections using a web UI)

https://github.com/samuelvanderwaal/metaboss (CLI with useful tools for Metaplex software)