You could translate うちに to "before", but more accurately it'd be closer to "while" or "during" as in "during a period when a certain situation remains in effect"

雨が降らないうちに帰りましょう。= While it is not raining, let's head home!

前に on the other hand has a clearer distinction of what happens before.
私はに東京へ行く前に日本語を勉強しています。= Before went to Tokyo, I studied Japanese.