How to personalised NFT during minting

Hello there, I’m building a test app around a use case that I’m having difficulties in laying down.

Basically I’d like to create an NFT that can be personalised during the minting process from the user itself.

Let’s say that I create a collection of ERC721A tokens. In the page where the minting button will be you can select an option, let’s say ā€œcolorā€. So you have a dropdown menu with some colors, and after selecting your preferred colour for every NFT you click mint and I personalised the background of the NFT minted with the color of your choice.

Now, I was thinking about passing the value of the color to the mint function. But for what I understand can increase the gas price a lot (if you want to mint 100 NFTs you need to specify 100 colors as well), can anyone confirm?
Also what if I don’t want to pass just a color but a long string? It’s gonna be super expensive…

The other thing that I thought was: when the user clicks mint, it actually calls a back-end. The server receives all the information about the colors, then it proceeds to mint for you, when the minting is done I receive back the ID of the NFT and with the id and the colors I call pinata api to update the metadata with the specified colors. The problem in this case is I don’t know how to make the back-end mint for a user.

What’s the best way to get this done?

So you want the NFT image to be customizable before it’s minted? Then this image when finished can be uploaded and used in the metadata for the NFT’s token_uri. If it’s metadata you’re talking about, then that also goes into the token_uri (unless ERC721A works differently).

Now, I was thinking about passing the value of the color to the mint function

ERC721A’s _mint takes parameters of address to, uint256 quantity and the base tokenURI is set separately.

You can start with a regular ERC721A collection/contract before doing dynamic NFTs like this to get an idea of how it works.