Adding current collection index (number of mints) to the collection data that comes from the event stream. This should be done on the frontend.

Tracking this information depends on how your smart contract is structured.

If there is a single smart contract that houses ALL your NFTs across different collections, then you will probably want to use an indexer like The Graph to separately track NFT collections efficiently or store those collection counts in a mapping inside the smart contract e.g.

mapping(uint256 => uint256) public collectionCounts;
// collectionID -> collection count

I prefer to make each NFT collection separate smart contracts, in which case you can look up the token index directly from the contract.

// each contract contains a tokenIndex like such that can be accessed
// directly from ethers.js
uint256 public numberSold; // token index (makes sure to mint new tokenIDs)

You can affordably create unique smart contracts using https://github.com/wighawag/clones-with-immutable-args

My tests have contract creation down to around 70,000 gas

Allowing fans to send ETH to the contract and receive an NFT in return. It works without the payment part, so I’m not sure where it’s breaking.