🏡 Go Home My GitHub My Twitter My Discord Email Me

← Go Back

Making Quill - A Developer Log

March 26th 2021, 3:03 AM (UTC)


I wanted a blogging platform that I could quickly publish new content without much hassle. I also wanted it to be secure and on my own terms. So I did what I always do; barely look for something that already exists and then decide to make my own. I am going to make the rest of this post a developer log about the creation of the platform. Enjoy!

The idea

The purpose of the blog is to be quick and easy to add a new post. The way I am planning to currently do this is by using email. You will email a post in markdown format to a specific email. This will then be converted to HTML and added to the site.

How it's gonna work

When you send an email to the specific email address, it is detected using IFTTT webhooks and Gmail integration. This webhook then sends the body, subject, date, and email to the Quill API. The API will then take that data and form it into a blog post. It will then clone the site, update the HTML for the blog, and commit and push its changes.

Day 1 - Overview

Day 1 was planning day. I tried out a variety of methods to see what will be the best way to handle submitting new posts to the blog.

Choosing the Stack

I originally tried to write the API with node.js and express, but my knowledge of PostgreSQL is extremely limited and the node.js integration is quite confusing. This is why I decided to go with Django, as I am much more familiar with Django and Sqlite3. My choice of Django also lets me easily make templates for the HTML that, in the end, will be uploaded to the site.

Day 2 - Overview

The python site is now up and running, mostly. I had a lot of success getting the email to be received by the API and double-checked based on the API Key provided. Currently what will happen is that when a post is submitted, it is checked to make sure it has the right API key attached. If it does, the blog post will be submitted; if it does not, the post will be rejected.

Running git

A big part of the site is the ability to upload directly to Github from the API so the website can be updated after you submit a new post. I ran into a lot of issues using GitPython For some reason my files were only sometimes being committed, and when they were, they were usually blank. This is why I decided to go with the current solution of running git through a Python Subprocess. This allows me to essentially use git basically in a command-line environment where I do not have to worry about any libraries. This didn't solve my problem completely, but now commits are actually being committed. However, files are still bank.

Day 3 - Overview

Today I took a break and just had some fun doing other things and working on other projects. Always remember to take breaks!

Day 4 - Overview

So, it turns out that you need to use file.close(). If you don't, files won't update on the file system. Once I implemented this across the code, everything started to work. This one change killed a lot of the project until I found out about it. This is also probably the reason that GitPython was not working correctly, I may try and work GitPython back into the project eventually.

Day 5 - Overview

Day 5 was just some cleanup of the code. I switched all of my git code back over to GitPython because it is a lot cleaner than running subprocesses. I also added a refresh API so you can refresh your blog by making a post request to the refresh API.

What next?

Quill is just getting started. I am hoping to continue working on it, with bug fixes and new features. The final goal for Quill is to turn it into a bigger blogging service that people can easily spin up their copies of using a robust API and app. However, this is super far down the road and not something I have time to do right now.