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.