Simple daily adjustments are often enough to reduce the frequency of spasms:
Gentle stretches before bed : focus on movements targeting the calves and thighs.
Regular hydration : drink small amounts throughout the day, without excess before night.
A diet rich in minerals : avocados, dried fruits, green vegetables and cocoa are your allies.
Suitable sleeping position : on your back, with a small cushion under your knees to relieve leg strain.
Hot or cold : apply a hot water bottle to relax the muscle, or cold if the pain is inflammatory.
When should you consult a doctor?

If your cramps become frequent, particularly intense, or are accompanied by other symptoms (swelling, muscle weakness, persistent pain), it is important to consult a healthcare professional. This will help rule out an underlying circulatory or metabolic problem.
In summary : nighttime cramps aren’t dangerous, but they can significantly disrupt sleep quality. By adopting good habits—stretching, staying hydrated, maintaining proper posture, and eating a balanced diet—you can give your muscles the rest they deserve and enjoy more restful nights.