The chemical reactions and pathways resulting in the formation of the heparan sulfate proteoglycan, a glycosaminoglycan with repeat unit consisting of alternating alpha-(1->4)-linked hexuronic acid and glucosamine residues; the former are a mixture of sulfated and nonsulfated D-glucuronic acid and L-iduronic acid; the L-iduronic acid is either sulfated or acetylated on its amino group as well as being sulfated on one of its hydroxyl groups; heparan sulfate chains are covalently linked to peptidyl-serine by a glycosidic attachment through the trisaccharide galactosyl-galactosyl-xylosyl to serine residues.