Here are my tips and comments based on my freelance experience:
1) It depends on the client. You can start with a 25% upfront as a default, another 25% midway through the project and the rest upon completion. Carefully detail the milestones and payment options in your proposal. You can also offer a discount for paying upfront. Some clients might not be able to adhere to your payment requirements due to bureaucracy reasons, like NGOs or Government; they usually have their own set of rules you have to follow in order to work with them; don't fight it.
2) The app or whatever you coded is for them to keep and the libraries you use are probably under an opensource license. Libraries you make for the project is work you've done for the client, so it would be difficult to argue the code is completely yours. Usually you give full rights over the final product, as a whole, but you can incorporate a copyright clause in your contract to cover different cases. For example (change the word "Designer" to whatever fits best):
- a) Until payment is made in full, Designer holds full rights to each
and every original design created for Client under this Contract.
- b) Client understands and agrees that Designer owns all of the
concepts/preliminary designs created before the final design(s)
- c) Client agrees that Designer will retain the right to use the final
design(s) and all preliminary designs in design competitions,
publications on design, educational purposes, and in marketing
- d) Any materials given to the Designer by the
Client (text, photographs, videos, etc.) must not violate patent,
copyright, trade secret or other property rights of any person, firm
3) The contract should be as detailed as you need to cover yourself. Include everything you can think of that is important to have in written agreement. Here's a list of things that you should probably include:
- Project Description: scope of work, delivery options, materials required...
- Date of Completion: project start and end date
- Acceptable Delays: unforeseen events, family...
- Estimated Cost: per hour, per package, per feature...
- Milestones: detailed breakdown of project phases, production steps...
- Payment Terms: payment options, cancellation penalties...
Then I'd make sure to cover these cases to avoid changes that are are out the scope of the project or that may require a separate contract:
- a) Minor changes and additions such as correcting text or changing colors can be requested within X days upon completion of the Project. All changes must be made within the Scope of the original Project Description. Designer reserves the prerogative
to determine what consist of a minor change.
- b) Any other changes or work not covered by this Contract will invoke Designer’s hourly rate of X per hour. This payment will be in addition to all other amounts owed under this Contract. Depending on the work requested, it may be necessary to amend this Contract or create a new Contract.
Also, remember that you're not the client's employee; I think it's important clarify this so I usually add a clause at the end of the contract, something like:
Client understands and agrees that Designer is an independent
contractor and not the Client’s employee. Although Client will provide
direction to the Designer, the Designer will determine the manner and
ways in which design(s) are created for the Client. The work created
for the Client under this Contract will not be deemed a
4) Unfortunately cost depends on many factors, primarily location, and cost of living. There's no secret formula. I find it easier to always estimate in hours of work, even if you bill per project, or per feature. All you need is an accurate rate in your area. In the US it varies from $50/h up to $200/h depending on expertise, size and complexity of the project, outsourcing, and many other factors.
For small projects I find that packages work best. You start with a base package, and provide different add-ons previously estimated in hours, for example a web project might look like:
// Package 1
Basic: $1500 static site up to 5 pages + $100 per page
Responsive add-on: $1000
// Package 2
WordPress: $2500 up to 5 content-types + $250 per content type
Social media add-on: $500
User login add-on: $1000
I think it's important to give the clients choice, but also direction. I'm no law expert so most of the stuff I've put together is from the internet, after reading hundreds of different resources on freelancing.