Dude, my car will just shut off sometimes and wont start back up. When its running, it runs fine and idles fine.

WTF? I was stranded at school for like 20 miniuts today. I can hear my fuel pump going, nothing leaking, motor kicked over fine just wouldn't start at all. Other times it just shut off all peacefully at a red light and then I would just start it up with no problem.
Im gonna take it to a mechanic but right now Im trying to decide who to go to.
What could it be? I'm thinking alternater, starter, relay/ electrical issues. What do you guys think?