I will touch on a few of the issues here, though this is actually quite a big topic:
Field layout
One field per line is best for mobile. But if many users will be using a larger screen (desktop, laptop or a decent size tablet) then typically City, State and Zip Code can be placed on the same row.
Street, Street Number and (optionally) Apt./Suite #, are typically combined into one field. In the US and many other countries it is 123 Main Street, Apt. 3G*, but the sequence does vary in some countries. Unless you have a specific need, generally best to let the user enter it however they see fit. The one big use I know of for Street Number is for credit card validation, but the systems I have worked with can generally take the entire first line of the address and parse it themselves.
Country and Country-Specific Fields
Country should be a select/drop-down list. You can use the selection from this list to:
- Provide a select/drop-down list of States/Provinces - or if you have a country where you don't know the States/Provinces, provide a text field instead.
- Determine the need for and size of the Zip Code field, though you could simply use long-enough-for-everywhere text field instead.
Sequence
I generally start with 2 or 3 lines of general address, followed by city, since those fields will apply everywhere. Then I list the country because changing country will change the State/Province list. List are State/Province and Zip Code.
Other Stuff
There are different preferred mailing formats, so if you are actually physically mailing things on a regular basis then you should look into that. However, the typical pattern is most-specific at the top, least-specific (country) at the bottom.
If you know your most popular countries, make the most popular country (and the associated State/Province list) the default, and try to set up State/Province lists for the next several most popular countries. Of course, if this is a new system then you may not have any idea what the most popular countries will be, and you will never (practically speaking) be able to cover everything. If it is a US-centric (but not limited to US) site, States/Provinces for US, Canada, Mexico may be sufficient for 90% - 99% of your users.