Birdfeeder Tech StackPublished on March 22, 2022
After sharing some information about how Birdfeeder collects your Twitter bookmarks and sends them to your inbox we are going to take a look at the technical foundation of the project in this blog post.
Spoiler: It’s a boring Rails app and it’s good that way.
Collecting the bookmarks
This would be a straight forward project if you could use the Twitter API for it. Unfortunately this is not supported by the old Twitter API and not yet implemented in the new one. Luckily it’s on the roadmap for the Twitter API V2.
Because of that limitation I had to build a browser extension that collects the bookmarks while you interact with your Twitter account in the browser. Right now there’s an extension for Google Chrome and one for Mozilla Firefox. I wrote about my experiences with building the extension in another blog post in case you are curious.
Storing the bookmark information
The backend of Birdfeeder is built using Rails 7, Postgres, Redis and Sidekiq. The browser extension is using cookies to figure out the Birdfeeder User ID and Twitter User ID (That’s why you have to be logged into both Twitter and Birdfeeder). Periodically it submits new bookmarks to the getbirdfeeder.com/bookmarks endpoint where they will be stored if they don’t exist yet.
When a bookmark is stored we have to fetch the meta information for the Tweet ID. This is done through a cron job which executes a Redis-backed Sidekiq task. This task is using the user’s Twitter information to fetch metadata for the tweet that will then be displayed in the weekly email. Using the user’s Twitter token to fetch this information makes sure that they can see bookmarked tweets that are private and only visible to them.
Sending the email
If there’s one thing I learned from this project it’s that building email templates is hard if you have to do it by hand.
Luckily I found a framework called Maizzle that makes it as easy as it gets. It is based on Tailwind and compiles your template into email-ready HTML with inline CSS (HTML Emails have a lot of limitations, one of them is that the styles have to be inline).
Can’t recommend it enough!
Rails, TailwindCSS and TailwindUI.
That’s already all there is to it. Follow me on Twitter if you want to follow the project progress.