Since you're working on this by yourself, it's up to you to make up your own git branching strategy.
Strict rules like "never commit directly to main" are mostly for actual collaborative work, to e.g. make sure that every code change is reviewed.
For yourself, it's totally OK to use branches only for features that you'll be working on for a longer time but don't want to have in the main branch right away, and commit directly to main for smaller changes.