tl;dr (but really, read it): it's about the people, not about the code
If you want a contract, here's one that someone gave me years and years ago. I never had it vetted by a lawyer, so YMMV, but it is clear enough about the important things. https://www.mooreds.com/standardContract.html The Nolo books have contracts too.
I'd advise hourly billing and weekly or biweekly invoices getting started. There are lots of options but that is the simplest one for both sides.
tl;dr (but really, read it): it's about the people, not about the code
If you want a contract, here's one that someone gave me years and years ago. I never had it vetted by a lawyer, so YMMV, but it is clear enough about the important things. https://www.mooreds.com/standardContract.html The Nolo books have contracts too.
I'd advise hourly billing and weekly or biweekly invoices getting started. There are lots of options but that is the simplest one for both sides.