Erc20 staking token

Hey!
So, I was wondering on how to make a smart contract that allows the token to be a stakable token, that has the capabilities to be implemented in a web app to be staked and make it so the user get rewarded with the same token apy%, I can not seem to grasp how to connect and implement those two features.

(sorry for the bad English by the way, English isn't my 1st language)