If you're interested, you can find the code here: https://lab.forgefriends.org/ta180m/gitea/-/tree/feature-manual-inbox-outbox2
This is a great start, but there's still much more to do: supporting following remote users, the UI, database persistence, code cleanup, error handling, and unit tests. Good thing the hard part's over now!