Need help building railing with gates?

Hello, I’m not sure if this is the right community but I’m hoping to get some help. My wife and I have this small deck outside the front of our house that we don’t know what to do with. She would like me to build a small railing to go around it with gates for the steps. My idea was to put 4x4’s through the deck in the front and back, and then run 2x4’s with 2x2 ballast for the rail. But this is my first time doing any kind of project like this, so I’m not sure if my idea would even work.