Whatever else you do, make sure you agree in writing. While this will help if you fall out in the future, it will force the two of you to consider what is important right now, meaning you will reach a much more thought out conclusion.
On to the nitty gritty, I find it helpful to consider two 'extreme' scenarios based on who takes the risk:
Your friend could get a bank loan and pay a contractor to do the work (for arguments sake let's say $30k). This will cost your friend $30k + interest over the time it takes to repay the loan out of website profits. This has a moderate amount of risk: the website may never make enough to repay the loan.
You work for free, for some agreed percentage of profits. You take the risk the website never makes enough money to repay you for your work.
So, as a starting point, you want to make sure your total remuneration is $30k + interest. The time this takes to pay to you can be estimated based on the current profit the site makes.
Then, you need to think about the risk you are taking in delaying payment for this amount of time. The longer the expected repayment time, the bigger the risk. Some of things that can be offered in return are
- A equity share in to company (if one exists)
- A percentage of profits. This should be tied in to how much you make, for example 50% of profits until you have earn't 30k + interest at 15% pa (the high rate reflecting the high risk). If it appears you can never be repaid (using a reasonable estimate of revenue growth) it's completely appropriate you should get a percentage forever (this is basically equivalent to an equity share)
- Competitive performance bonuses: what if traffic to the site doubles once you rewrite it? That's a direct contribution your hard work and web design flair has made, over and above the value of your friends original idea. You could agree for you to be paid a high percentage of profits from traffic in excess of what the site already sees.
The above should give you some ideas on how you can value your contribution, and the sort of package you would like to receive. It also has plenty of variables that you and your fir