DEV Community

Cover image for Tech-blogging the easy way
neoan
neoan

Posted on

Tech-blogging the easy way

Lately I have seen a lot of posts here about how to set up your own blog. It's not a surprise that a regular Wordpress-installation doesn't really scream developer. On my personal blog neoan.us/blog, I use blua.blue and if you are a follower you will notice that many of my dev.to contributions originate from there as well (whenever I want to publish to multiple sites/services). However, knowing that the PHP-crowd here is miniscule I decided to provide you with 2 repositories you can start with that do not require the use of the blua.blue-API (because they are webhook-based) and allow you to simply design your blog using the means of your choice.

Description Repo
serverless framework

blua.blue Serverless Framework Node Express API on AWS

This POC is based on the serverless node/express/api template with added support for s3 bucket storage and rendering.

Setup

  • Create a bucket and ensure that your AWS cli AIM has the required permissions to read & write to this bucket.
  • Change line 8 of handler.js accordingly: const bucketName = 'my-article-storage-bucket';

Usage

Deployment

Install dependencies with:

npm install

and then deploy with:

serverless deploy

Enhance

The current setup is a POC to ease local development (when using serverless-local). Ultimately, you may want to set up your bucket as a website and permanently render what is now done in app.get('/:slug?) to HTML files (pug.compileFile) to enjoy a static blog.

file-based (mono-repo node & PHP)

minimal-blog

blua.blue webhook POC

This little repo can be run either with node or PHP and serves as a proof of concept for blua.blue based blogs without using the API or SDKs. Both the PHP-version and the node-version are based on a total of less than 75 lines of code. The PHP version is even completely free of dependencies.

The goal of this project is was to create the easiest possible setup to host your own blog.

See it here: https://equinox-vivacious-havarti.glitch.me/

How to use

  1. If you don't have an account, sign up at blua.blue
  2. Clone, fork or download this repo and host it depending on your needs*
  3. Set up webhooks on blua.blue
  • PHP-endpoint: https://your-site.com/receive.php
  • node-endpoint: https://your-site.com/receive

*Be careful of hosting via services like heroku: many of these services delete files written to the file-system after some idle time

That's it. Enjoy

How to use them

After deploying one of these versions, sign up with blua.blue and navigate to your profile. You will find the tab "Webhooks". With both repositories, you will want to generate a webhook to https://your-endpoint.tld/receive. There is no need for a token as we check for allowed origins, but ultimately you will want to set one of your choice and then verify the source of the payload (sent through authorization header as bearer token) in order to prevent other blua.blue-users to post on your behalf.

That's it

Lastly, please be aware of two things:

  1. These repos are very basic and meant to be a boilerplate rather than a final solution. I am happy to accept pull-requests
  2. Share! If you built something beautiful, let everyone know in the comments!

Discussion (0)