Matthew Lang avatar

Matthew Lang

Web developer with a preference for Ruby on Rails

Writeabout

A re-designed Writeabout

Over the holidays, I gave my writing prompts website, Writeabout, a wee freshen up.

Previously, Writeabout was just a single page that displayed a random writing prompt on each page refresh. Simple, yes, but the design would not allow me to easily expand the website.

I started over with a simpler design. Display the most recent writing prompts in date order, with the added ability to explore other prompts through tags. A simple admin console on the backend lets me add and update writing prompts, and upload a batch of prompts so that future prompts are queued.

It might seem almost redundant to have a website with a collection of writing prompts that could easily be replaced by any popular AI tool. However, over time, my plan is to curate and build collections of writing prompts that retain an element of human touch in their creation.

Also, this new version of Writeabout uses Rails 8.1, my first venture into a Rails 8 codebase in production. It will also serve as a learning platform for me. I’ve already opted for a “no build” approach to Writeabout. So it’s out with Tailwind CSS and in with plain-old CSS and JavaScript.

The source code for Writeabout is on my SourceHut account.

Web development like it's 2009

I am in favour of Simon Willison’s “no build frontend” web development approach.

If you’ve found web development frustrating over the past 5-10 years, here’s something that has worked great for me: give yourself permission to avoid any form of frontend build system (so no npm / React / TypeScript / JSX / Babel / Vite / Tailwind etc) and code in HTML and JavaScript like it’s 2009.

I’ve been building Writeabout in Sinatra, and I’ve reached the point where I need to add a bit of JavaScript to allow the changing of the light, dark, and system themes. I already have these implemented in the original Rails code as Stimulus controllers, but I’m sure it won’t be too much work to rewrite them as plain old JavaScript.

I don’t have a favourable opinion of frontend web development. I’ve always found it unnecessarily complicated and constantly changing, but rarely for the better. For the last few years, I’ve used TailwindCSS because its build step in Rails applications is minimal—the productivity gains outweigh the added complexity. Beyond small learning projects, I’ve resisted adopting anything like React or TypeScript.

That’s pretty much most of my repositories moved from GitHub to sourcehut.

Writeabout is still on GitHub but is undergoing a Sinatra rewrite. Once that’s complete, I’ll mark the one on GitHub as archived and publicise the new one on Sourcehut.

More of my projects will gradually appear on sourcehut.

A couple of web development projects for the winter

Now that the golf season is down to me and the boys only getting out at the weekend, I can start spending more time on a few side projects. There are so many things I would like to learn, but I figure just limiting myself to a couple won’t take up too much of my time.

So, from now to March, I’ll spend a few hours each week on the following.

  • Learning more about Rails 8 and KamalDailymuse and Writeabout will each get a bump to Rails 8. Only Writeabout, though, will get the Kamal) treatment to begin with. When I have gained enough knowledge about Kamal, I’ll also look to deploy Dailymuse with Kamal.
  • Learn TypeScript and ThreeJS — A work colleague showed me a hobby project he is working on using ThreeJS. It’s the perfect excuse to learn TypeScript and build something for the web that isn’t just another web application.

Setting up Hatchbox

I’m posting a short post tonight as I’ve been spending the evening setting up a Hatchbox account and migrating the first of a handful of Rails applications to it. The setup was straightforward, and after 45 minutes of tinkering, I got my Writeabout app running on it. I’ll try to move a couple more applications over tomorrow.

This is the second in my build updates for 2022.

Last month I mentioned my intention to look at BlitzJS. After a few hours of wrestling with a small application, I wondered if it would be better to spend some time refreshing my React knowledge first (it’s been a while since I used this) and then re-visiting BlitzJS. So I decided to park this for something else.

I wrote and maintained my own blogging CMS using Ruby on Rails for a couple of years. It was simple, and it had several excellent features like posts grouped by dates and supported posts without titles. There were a couple of downsides to the application, though.

Running even a small Rails application isn’t cheap, and while I can afford to host the app, it was money that I thought I could spend elsewhere. I looked to alternatives, but I couldn’t find anything with a significantly cheaper CMS to host. I started then to look towards a static site.

With some experience in using Jekyll, I started migrating all my posts both on the Rails application and in Micro.blog to my own Jekyll blog. I’m running the site on Render using one of their cheap static site plans, and I’m pleased with the result.

The added benefit of this is that I now have complete control over my blog, both in content and hosting. My content for the website is just a bunch of files. Posts use Markdown and are effectively just plain old text files. My images are stored in a folder that is served as part of the website. I find this much easier to control than digging into the database for a CMS.

As for hosting, I loved having my blog hosted on Micro.blog, but I did find it limiting in some ways. I would still recommend it for most people, but for me, self-hosting everything was the way to go.

One final benefit of using Jekyll is that I can still use Tailwind CSS to style the website and play about with it a bit more. You can see an example of this on my now page, where I have created a book component to show the progress of the books I am reading. I’ll be expanding on these over the year as I read more books.

It’s been a while since I made any changes with my writing prompt generator Writeabout, but it’s seen a flurry of activity over the last few weeks.

  • Writeabout is now running on Rails 7 and Ruby 3.1. I’ve been keen to move away from Webpacker and embrace Rails' new JavaScript options with Rails 7.
  • I’m using the latest version of Tailwind. I love Tailwind. I find it easier to build web pages using Tailwind’s classes.
  • I replaced the dark/light theme with a better recommendation using the suggestion from the Tailwind docs. This behaviour is still bundled in a Stimulus controller, but I’m pleased with the result.
  • Self-hosted font. I used to use Google Fonts to serve this website’s font, but I’m keen to reduce outside dependencies where I can, so I switched to self-hosting the font for Writeabout.

I’m still not done with Writeabout, though. As a small application, it provides me with an excellent place to try new things. Over the rest of the year, I plan to add the following two significant changes.

The first is an admin screen built on Hotwire. I’ve done some things with Hotwire, but nothing major. It would let me manage the prompts for the website and provide some information on API requests.

The second change will be an iOS app using React Native. Yes, I know React Native lets you build apps for both iOS and Android, but I’ll initially just be making a Writeabout app that supports iOS. If there’s not too much legwork to get it working in Android, I will also support that.

I need to ship Rails app updates more often

On Sunday night, I migrated a couple of Rails apps to Ruby 2.7, including Writeabout. Last night, I did the same with another Rails app. By the end of the week, I hope to have Markcase moved over to Ruby 2.7 and Dailymuse upgraded to Ruby 2.7 and Rails 6.0.

Upgrading apps is a pain if they’re left alone for too long. I’ve left Dailymuse alone for such a long time that it’s still sitting on Rails 5. Markcase is on Rails 6 but requires a wee bit of maintenance regarding Webpack.

I’ve learned that leaving apps for such a long time between updates is not the best thing to do. Even upgrading an app regularly through its patch versions is better than just leaving them sitting gathering dust.

I’m going to add a back-end admin plugin to Writeabout to make the adding and updating of writing prompts easier.

I intended to have an admin API endpoint to manage the prompts, but for a short term fix, I’m going with the admin plugin route.

Last night I added a fav icon, a touch icon and Twitter card handling for Writeabout.

On the face of it, one could argue this is purely a vanity change. It was actually a test run to see what’s the minimum icon changes I need for a web app.

Baby steps with StimulusJS

Last night I needed a much needed break from the usual Rails coding, so I worked through an example on the StimulusJS website so that I could add a “copy to clipboard” button for the displayed writing prompt on Writeabout.

For me, this is the ideal level of integration I need with JavaScript. A framework that does some of the heavy lifting on the user-interface without me having to re-write the whole front-end.

The end result is nice, but I don’t like the way the elements on the page move up and down when the copy button has been pressed. I’ve added a little div section with an indicator that the button has been pressed. It disappears after a few seconds, but it moves the elements on the page up and down when it changes its display state. I’ll fix it another day, but the first pass at this functionality is still good.

Adaptive product naming

A favourite saying of mine is Phil Karlton’s quote about hard things to do in computer science.

There are only two hard things in Computer Science: cache invalidation and naming things.

— Phil Karlton

I can’t say that cache invalidation has given me major issues in the past but naming things has always been a challenge. If I was to take this beyond the realms of programming though, I would say that naming anything is a difficult thing to do.

My portfolio of web applications include DailyMuse, Markcase and WriteAbout. I find it hard to get away from the compound naming theme. It’s just a way of naming things that I stick with. It’s easy to do, but it feels like it lacks imagination. I would love to come up wth alternatives that don’t follow this convention but everything I have come up with didn’t feel like a good fit.

The other thing I don’t like about compounded product names is deciding whether to upper-case the second word or leave it as lower-case. GitHub’s branding is clear that they favour upper-casing the second word, but there are examples of other brand names that are made of two words that just user a lower-case word for the second word. Take Feedbin for example.

For my bookmarking service, Markcase, I choose to use the lower-cased form instead of MarkCase, and I have to say I prefer it.

I’m working on something that is bigger than anything I’ve worked on in the past. I’d like it to become my full-time gig eventually so it’s quite important to get the naming of it right. I do have a name for it, but I’m torn between whether to use the upper-case form or the lower-case for.

I am edging towards the lower-case form. It reads easier and looks better in the different styles that I have for it.

I find all aspects of branding and marketing quite a challenge. I’m creative to an extent, but I’m definitely not well-versed enough to launch a huge marketing campaign. To get my product off the ground though, I’m taking little steps in executing it and learning as I go. I might not always get it right to begin with, but adapting the product and the marketing as I go, is better than not doing anything at all.

3 Ways to Tell the World About Your Idea

An idea is nothing unless you can tell it to someone else. With the world on the web at your hands, your ideas can now be seen by millions of people in a matter of minutes. Here's a few ways I have tried out communicating various ideas in the past. Each had a degree of success, but I can't recommend one over the others. In the end, they all have their place in getting your ideas out there as they do suit different levels of knowledge, you just have to decide which one will suit you.

Write About It

Just write about it. Like I said yesterday. Your ideas are perhaps best spread by yourself in the way you describe it through your own words. Publish the idea in your blog and look at the number of views for the idea over time and see if it's maintaining a certain number of views. If your idea is maintaining a steady number of views maybe over a week then your idea could be worth developing further.

This is the simplest but least accurate way of validating an idea. Measuring the popularity of the idea in terms of page views is a simple measure, but what we lack here is the ability to see how many people are genuinely interested in our idea.

A Landing Page and Signup Form

Even before you build something around your idea, it's a good idea to get feedback on the popularity of the idea. Landing pages with a signup are a great way to gauge the initial interest in your idea. So even before you have started work on your idea, you can determine if it's worth pursuing.

A landing page gives the benefit of allowing you to get your first set of customers for your idea. Not all the people that signup will actually buy into your idea, but it's fair to say that a percentage of them will consider your idea if your idea will offer some form of value that is worth paying for.

Services like LaunchRock can have a landing page up and running for you in minutes, but it is better to spend the time in getting the landing page right. A little bit more time spent on getting the landing page right can mean a big difference in the number of sign ups you get.

A Prototype

A prototype of your idea is probably the best way to show it to the world, but it is also the most time consuming to put together. You might spend just an hour putting together a blog post, maybe a couple of hours getting a landing page up and running, but a prototype might take you at least a day to put together depending on how much of the idea you want to implement.

The first prototype for Journalong was a spectacularly simple affair. It was just a page with a textbox and a button. No fancy styling, validation or even tests. I was merely testing the idea of submitting my journal entries from a web site to my Dropbox. I showed the idea to a few developers in the team I was working in at the time and they liked the idea. It gave me the confidence to pursue the idea further.

A point to remember when building a prototype is that you should really focus on making it show off the primary value that your idea will give people. For Journalong the value was writing your journal to your Dropbox from anywhere. Web connectivity is almost available everywhere we go, and armed with a smart phone most people are no more than a few clicks away from writing to their journal.

So there you go. Three ways you can communicate your idea to the world. Most people shouldn't have any problem in writing a blog post or even using LaunchRock to put a landing page together. A prototype is a bit more technical and requires more time and effort if you are not familiar with web development.

Next time you have an idea, why not tell a few people? You might just be onto the next big thing.