Understand how transaction size and fees calculation works in caravan Looks like there is no activity in caravan github repository so maybe someone here can help me with this issue. Already mentioned everything in the below link however my three basic questions are:
https://github.com/unchained-capital/caravan/issues/173

How does tx size and fees calculation work in caravan?
How does it work in other projects if there is any better implementation?
Will there be a standard and easy approach to solve this problem in future which can be easily used by every bitcoin project?
The fee rate is pulled here:
export function fetchFeeEstimate(network, client) {
  if (client.type === BLOCK_EXPLORER) {
    return blockExplorerGetFeeEstimate(network);
  }
  return bitcoindEstimateSmartFee({
    ...bitcoindParams(client),
    ...{ numBlocks: 1 },
  });
}

(https://github.com/unchained-capital/caravan/blob/3514039983984e184e8babb6c61c21a46798fc70/src/blockchain.js#L97-L105)
It depends on if you are using a block explorer or a local bitcoind node.
If using bitcoind, it uses the estimatesmartfee rpi cal:
export async function bitcoindEstimateSmartFee({ url, auth, numBlocks = 2 }) {
  const resp = await callBitcoind(url, auth, &quot;estimatesmartfee&quot;, [numBlocks]);
  const feeRate = resp.result.feerate;
  return Math.ceil(feeRate * 100000);
}

(https://github.com/unchained-capital/caravan/blob/3514039983984e184e8babb6c61c21a46798fc70/src/bitcoind.js#L111-L115)
As for the transaction size/ total fee calculation, caravan uses estimateMultisigTransactionFee from unchained-bitcoin
(https://github.com/unchained-capital/caravan/blob/fd214eb573c7185c01dfa2040aa914e87a0de359/src/actions/walletActions.js#L129)
Which depending on the transaction type (P2SH, P2WSH, P2SH-P2WSH) calls a transaction size estimator. The P2SH one is:
export function estimateMultisigP2SHTransactionVSize(config) {
  const baseSize = 41 * config.numInputs + 34 * config.numOutputs + 30;
  const signatureLength = 72 + 1; // approx including push byte
  const scriptOverhead = 4; 
  const keylength = 33 + 1;  // push byte
  const sigSize = signatureLength*config.m*config.numInputs + keylength*config.n*config.numInputs + scriptOverhead*config.numInputs;
  const vsize = baseSize + sigSize;
  return vsize;
}

(https://github.com/unchained-capital/unchained-bitcoin/blob/e9177e7171c3bf11ad5c245c7d633dac484f409c/src/p2sh.js#L27-L35)
Regarding your other questions, I look forward to hearing more about this. When we wrote this, I wasn't aware of unspents. It would be nice if there was a standard, well-tested package for calculating transaction fees.
Regarding other projects: Lily uses unchained-bitcoin: (https://github.com/KayBeSee/lily-wallet/blob/5945175f9e25cc7a8ff29159de39c228b79ef205/src/pages/Send/utils.js#L48) so it's the same as Caravan. I don't know what Casa does. I would assume BitGo uses unspents that Murch linked to. I'm pretty sure Electrum has it's own thing, but I haven't looked, I'd assume the same for Specter.
Hope this helps, sorry we didn't get back to you on the caravan issue, infomational tickets like that are low-priority for us right now.