The most important primary prevention measure to help prevent nephrolithiasis is adequate hydration. Fluid intake should be at least 2 to 3 liters per day. Dietary factors are also important. Measures should include decreasing dietary fat, protein, and sodium intake. 
Long-term dietary modification is essential for preventing future calculi. Aim should be to obtain a 24-hour urine volume of at least 2 liters. Orange juice is able to bring the urinary citrate levels up much more than lemon juice because of its high potassium content.
Diet should be balanced with contributions from all food groups, without excesses of any kind. 
Fruits, vegetables, and fibers: fruit and vegetable intake should be encouraged because of the beneficial effects of fiber. The alkaline content of a vegetarian diet also gives rise to a desirable increase in urinary pH.
An excessive intake of oxalate-rich products should be limited or avoided to prevent an oxalate load. This includes fruit and vegetables rich in oxalate such as wheat bran. This is particularly important in patients in whom a high oxalate excretion has been demonstrated. The following products have a high content of oxalate:
Rhubarb, 530 mg oxalate/100 g
Spinach, 570 mg oxalate/100 g
Cocoa, 625 mg oxalate/100 g
Tea leaves, 375 to 1450 mg oxalate/100 g
Nuts, 200 to 600 mg oxalate/100 g
Vitamin C is a precursor of oxalate, taking more than 500 to 1000 mg/day is not recommended.
Animal protein should be limited to 0.8 to 1 g/kg body weight. An excessive consumption of animal protein may give rise to hypercalciuria, hypocitraturia, low pH, hyperoxaluria, and hyperuricosuria.
Calcium intake should not be restricted unless there are very strong reasons because of the inverse relationship between dietary calcium and calcium stone formation. The minimum daily requirement for calcium is 800 mg and the general recommendation is 1000 mg/day (refers to elemental calcium). Calcium supplements are not recommended except in cases of enteric hyperoxaluria.
A high consumption of sodium causes hypercalciuria by reduced proximal tubular reabsorption of calcium. Urinary citrate is reduced. The risk of forming sodium urate crystals is increased and the effect of thiazide in reducing urinary calcium is counteracted by a high sodium intake. The daily sodium intake should not exceed 3 g.
The intake of food particularly rich in urate should be restricted in patients with hyperuricosuric calcium oxalate stone disease, as well as in patients with uric acid stone disease. The intake of urate should not exceed 500 mg/day. Examples of food rich in urate include:
Calf thymus, 900 mg urate/100 g
Liver, 260 to 360 mg urate/100 g
Kidneys, 210 to 255 mg urate/100 g
Poultry skin, 300 mg urate/100 g
Herring with skin, sardines, anchovies, sprats, 260 to 500 mg urate/100 g.
Where specific metabolic abnormalities exist and are not responsive to dietary modification, specific preventive therapies may be required.  These include:
Uric acid stones: urinary alkalinization with potassium citrate or sodium bicarbonate
Hyperuricosuria, recurrent calcium oxalate stones, and normal urine calcium: allopurinol or febuxostat
Hypercalciuria and recurrent calcium stones: thiazide diuretic with or without potassium supplementation (potassium citrate or potassium chloride)
Hypocitraturia and recurrent calcium stones: urinary alkalinization (e.g., potassium citrate; sodium bicarbonate or sodium citrate can be considered if the patient is at risk for hyperkalemia)
Hyperoxaluria: oxalate chelator (e.g., calcium, magnesium, or cholestyramine), potassium citrate, pyridoxine
Cystinuria: urinary alkalinization with potassium citrate, thiol binding agent (e.g., tiopronin which is tolerated better than d-penicillamine)
Struvite stones: urease inhibitor (e.g., acetohydroxamic acid), which is best reserved for complex/recurrent struvite stones in which surgical management has been exhausted. Secondary care supervision should be employed as it can produce severe adverse effects such as phlebitis and hypercoagulability.
Use of this content is subject to our disclaimer