Underground water main line is the domestic water supply line between the water meter and house entry.
The main water line is required to be buried 12″ inches below the finished grade.
Water pipe approved materials
Water supply pipes and fittings shall comply with (Table 604.1) in the California plumbing code. The most common materials used are PVC, copper (type L or M), malleable iron, galvanized steel, CPVC, or other approved material and shall be in accordance with NSF 61.
If you are planning to use PEX for underground water line, make sure you sleeve the PEX pipe with an approved material for potable water use in soil or other material that is impermeable to solvents or petroleum products.
Using PEX for underground line is costly because you will end up paying for the same line twice, once for the PEX and one for its sleeve which an approved material for underground water.
Residential Main Water Pipe Size
The minimum size of the underground main water pipe is 3/4” inch. (CPC 610.4), but before going with the minimum size check (table 604.10).
If you have a fire sprinkler system installed, check with the local fire department for the minimum size of the main water pipe because the main line will feed the house as a domestic water and the fire sprinkler lines so it will be larger than 3/4 inch. (UPC 610.8).
Underground water pipe depth
Underground main water line shall be buried a minimum of 12” below grade. (CPC 609.1) (UPC 609.1).
Water pipes shall not be run in the same trench as building sewer or drainage piping constructed of clay or materials that are not approved for use within a building. (CPC 609.2).
If you can not have the water pipe in different trench than the sewer line, the water line shall be laid 12 inches above the clay sewer pipe.
If the sewer pipe made of an approved materials per CPC Table 701.2, the water line and sewer can be in the same trench.

Water line tracer wire
Non-metallic piping shall have a blue insulated 18-guage tracer wire tracer adjacent to the piping and shall be suitable for direct burial.
The tracer wire shall terminate above ground at each end of the non-metallic pipe. (CPC 604.10.1).

Hose bib Vacuum breaker
A vacuum breaker ( Non-removable backflow preventer device) is required on all exterior hose bibs. (CPC 603.5.7). Vacuum breaker prevent water cross contamination.

Water line Pressure Regulator
Where water pressure in the main water supply piping is exceeding 80 psi an approved-type pressure regulator preceded by an adequate strainer shall be installed and the pressure reduced to 80 psi or less. (CPC 608.2)(UPC 608.2).

Does replacing the main water line require a plumbing permit?
The answer is yes, Local jurisdictions ( cities, counties ) are requiring a plumbing permit to replace the underground main water line. The local agencies will require one or two inspections for the water pipe replacement,
Underground inspection – After removing the old underground main line and installing the new water pipe, inspector will verify the depth of the trench, the pipe material, size of the pipe, and water pressure.
Final inspection – After completion of the work.
Who can apply for a plumbing permit?
A Plumbing Contractor is required to apply for any related plumbing work. However, if the homeowner is doing the work himself/herself, the local jurisdictions will allow the homeowner to obtain the plumbing permit.
Reference Codes – Uniform Plumbing Code (UPC) – California Plumbing Code (CPC)