You absolutely need a good IP and contracts attorney to help you put together a solid agreement.
Without a solid agreement drafted by someone who knows IP and how to draft and negotiate contacts, you stand a high likelihood of getting terms that may sound okay, but you will find that you signed up for more work than you expected (e.g., acceptance and delivery terms, warranty provisions), to extend more IP rights than necessary (ownership, exclusive or perpetual licenses) or not even getting paid what you thought based on ambiguous payment terms. A good IP and contracts attorney can also advise on tricky open source licensing issues. Finally, such an attorney can help you get a fair allocation of IP infringement and other risks. Most tech companies don't want to make $1 million and then risk being on the hook for $10 million of their legal fees for something you did not cause.
Try to find an attorney who had training from a large tech-focused law firm and worked at a small technology company negotiating against large companies. You could compare legal fees and how well you communicate with a few lawyers and someone might be willing to do the project for a fixed fee rather than hourly. If the attorney actually can partner with you to get the deal done with the customer happy with the outcome, even better. Feel free to contact me. If I can't help you, I may be able help you find someone.