While a fence may seem like a basic installation, there are actually a variety of codes to following when installing one. First, know your property lines. Hire a surveyor to figure out exact boundaries if necessary. Also, check to be sure that your county or municipality does not require an offset from the property line. If you cannot find a surveyor, you can figure it out yourself by going to the municipality office and looking at their property maps. Furthermore, ensure that no permits are required for the fence. If they are, go acquire those permits to build the fence.
This video gives advice and guidelines you must adhere to for building a fence on your property: