〜ないうちに
Before (something happens), while it hasn't yetmachine translation
FormationVerb ない-form + うちに
〜ないうちに expresses "do B while A hasn't happened yet" — seizing the moment to act before the situation turns unfavorable: 暗くならないうちに帰りましょう (let's head home before it gets dark). This is the negative counterpart of 〜うちに: the window being seized here is the state of "A not yet having happened."
Compared with 〜前に, which you've used since N5, the difference lies in nuance: 暗くなる前に merely states a time point neutrally, while 暗くならないうちに implies "darkness would be a problem — act now before it's too late." That's why ないうちに suits cases where you can't predict exactly when A will happen, and it often carries a slight sense of urgency.
This pattern also describes something happening before you even notice: 気がつかないうちに寝てしまった (I fell asleep before I knew it). The familiar phrase 知らないうちに (without realizing it) is exactly this use.
Examples
暗くならないうちに、家に帰りましょう。
Let's head home before it gets dark.
忘れないうちに、メモしておきます。
I'll jot it down before I forget.
雨が降らないうちに、洗濯物を入れてください。
Please bring in the laundry before it starts raining.