Should I spend money to
get traffic in the early stage
of my startup project?

You can but if you don’t have a good level of discipline that can VERY quickly turn into a bottomless pit.

If you’re inexperienced (haven’t launched a couple of money-making projects) then your identity is likely still wrapped up in the success of your baby (idea).

In that case, I would recommend doing free marketing tactics instead. Figure out where your people hang out, see if they’ve got questions relevant to your startup, help them, and then pitch if it makes sense to pitch. (Do it with a bit of tact.)

In general, spending money to validate an idea is fine, but you have to be careful not to fall into the trap of throwing smart money after dumb money. If the experiment fails, kill it, and try something else.