DEV Community

Cover image for Living with a migraine as a software developer
Lazar Nikolov
Lazar Nikolov

Posted on • Originally published at

Living with a migraine as a software developer

Migraine affects 1 billion people worldwide. It's the 3rd most prevalent and the 6th most disabling illness in the world. It's worse than an ordinary headache. The attacks usually last between 4 and 72 hours. Whoever has, or had a migraine knows about the pain they had to endure and the sacrifices they had to make because of it. Managing a migraine is not easy. You're pretty much forced to change and adjust your lifestyle and habits. There is no pill that you can take to make it go away forever. In this article I'll cover the four things I do to manage my migraine.

Disclaimer! I'm not a medical professional, so take this with a grain of salt. These things worked for me, but they might not work for you. If you're seeking a medical advice it's a good idea to talk with your doctor.

Drink plenty of water

Staying hydrated is a key factor in managing your migraine. You should aim to drink at least 2 liters (~8.5 cups) of water every day. Not only you'll get fewer headaches, but they will also be less painful. Always have a glass bottle on your desk and sip. You need to build a habit for that. Also, it's a well known fact that drinking plenty of water is good for your health. Having a migraine does not have to be the reason why you should start drinking water.

Drink ginger tea

Alongside with the water, I also drink one cup of ginger tea. I always drink it in the morning, and then proceed drinking water. Preparing it is not a hustle. I boil a liter of water, transfer it in a large jar and add sliced fresh ginger to it. Then I keep the jar in my frigde and fill my cup every morning until I go through the whole jar. Then I do it again. I'm not sure what it is, but it does help me get fewer headaches.

Get a good 8 hours of sleep

Getting enough, but not too much sleep is not only good for your migraine. It's also improving your life and your mental performance. We are software engineers. We do our work with our brains, and sometimes we tend to overdo it. That's why it is crucial to rest our brains and get enough sleep. When I don't follow that rule of mine I'm most likely to suffer a migraine attack. To ensure that I get 8 hours of sleep I started keeping a routine.

Keeping a strict routine

I noticed that keeping a strict routine plays a huge role in having less headaches. In my early years at university I didn't have a daily routine. I was sleeping throughout the day and I was coding and gaming throughout the night. That's when I started getting strong headaches. I was suffering many attacks per week. That lifestyle was fun, but the frequent attacks made me put myself in order, because it started to become unbearable. Today, I'm following an easy, but strict routine and I'm almost to zero attacks every three months. Here's my routine:

  • Wake up at 8 AM
  • Drink my first espresso at 8:30 AM
  • Start my work at 9 AM
  • Have breakfast at ~11 AM
  • Have my second espresso at 2 PM
  • Go about my day
  • Get to bed before midnight

The routine stops at 2 PM. After that it doesn't matter how much I work. There were days where I coded until 10 PM and still didn't suffered an attack. So the level of mental activity doesn't seem to affect the migraine in my case.

The key is to follow my routine, especially in the morning. If I miss my morning coffee, or get up earlier or later, I'm most likely to suffer a migraine that day. I'm not into drinking alcohol, but whenever I do, I'm having headaches the next day, so I tend to stay away.


Migraines are not fun. Managing them can be tricky and it requires changing your lifestyle and habits to make it easier. I find that these four things work wonders for me through research and experimentation. There is no definite formula, and these things might not work for you. But overall, try to live healthy, drink plenty of water and get enough sleep.

Latest comments (1)

domters profile image
Mike Peters • Edited

Good post and quite interesting information. Headaches can be a big problem especially if you have difficult work! So you should always pay attention on your health, mood, visit doctor, and so on. Even if you suffer from migraine pain, you can always get help in special clinic. Also there are special pills which you can order even with overnight delivery. Such services are really useful in some situations.