Building a Simple Journal
I saw a post from Will recently about the CLI journalling tool, jrnl. It looked cool, but had some limitations for my needs, so I decided to build my own.
Will and I had a quick chat about jrnl, and my knee-jerk reaction was to give it a try, but when I took a breath and thought about it, I decided that jrnl wasn't for me.
You see, I'm most likely to write a journal entry before bed, either on my phone, or on my iPad. So a CLI tool is no good to me. This got me thinking about if I were to start journalling again, what my needs would be from a tool. Here's the list I came up with:
- Is web based, so I can login and journal from anywhere
- Easily self-hostable (is that even a word?)
- Has a super simple UI - literally a text box for the entry, and a list of entries
- It would be nice to have Markdown support so I can add some simple formatting
- Entries must be text (
.txt
) files so they're universally available - Having the ability to delete entries would be cool too
I've really enjoyed journalling in the past, but it's always been too much of a headache to maintain. Apps like Day One have too much going on, and I don't like the fact I'm sending my journal to a 3rd party. I tried building a Journal with WordPress in the past, but that was too much faff and so it didn't stick.
The hunt
So with the list above in mind, I started looking for something that would tick most of my requirements. But unfortunately I couldn't find anything.
I've been teaching myself PHP lately, so I figured this could be a fun little project for me to build something that ticks all my boxes. So over the last few days I've been playing around with my text editor, and with a little help from DuckDuckGo and ChatGPT (I got stuck a couple times - like I said, I'm still learning PHP, and Chatty Geeps really helped) I've managed to build something that works for me.
It's 5 PHP files, a tiny bit of JavaScript, and a CSS file (I also import Simple.css). In total, the entire project is around 450KB. So I can dump it onto any web hosting provider that supports PHP, stick a password in front of it, and I'm done.
- Is web based, so I can login and journal from anywhere
- Easily self-hostable (is that even a word?)
✅ - COMPLETE
The webUI is ridiculously simple. It's a single text box (that grows as you type - that's the JS) and a list of entries beneath. Here's what it looks like:
![A screenshot of my Journal app](https://kevquirk.com/media/pages/blog/building-a-simple-journal/d1d2776d19-1724079974/01.webp)
![An example of the journal homepage with an entry added](https://kevquirk.com/media/pages/blog/building-a-simple-journal/d184a55dd5-1724079976/03.webp)
- Has a super simple UI - literally a text box for the entry, and a list of entries
✅ - COMPLETE
I've been able to add Markdown support by making use of Parsedown.
![An example journal entry being typed in markdown](https://kevquirk.com/media/pages/blog/building-a-simple-journal/4a43276843-1724079975/02.webp)
![An example of a journal entry with markdown rendered](https://kevquirk.com/media/pages/blog/building-a-simple-journal/2cf4c962ca-1724079975/04.webp)
- It would be nice to have Markdown support so I can add some simple formatting
✅ - COMPLETE
Under the hood, a journal entry is just a plaintext file that's rendered within the HTML using PHP. Here's the entire journal entry (filename 2024-08-19-152739.txt
):
2024-08-19 15:27:39
Today I made this simple little journal. I think it works quite well. It also supports **markdown**. 😉
- Entries must be text (
.txt
) files so they're universally available
✅ - COMPLETE
As you can see from the screenshot above, there's an option to delete the journal entry, and I've also added next/previous links for good measure, which should make browsing the journal easier.
- Having the ability to delete entries would be cool too
✅ - COMPLETE
And with that, that's all my requirement complete. I did consider adding some kind of categorisation mechanism, and I still might. But for now, I think my little journal works really well.
If you're interested in giving it a try, I've dumped a demo online that resets itself every 10 minutes.
If you wanna give Journal a go yourself, you can nab the code from GitHub.
If you have any suggestions for improving Journal please do let me know - like I said, I'm not a professional developer, and I'm still learning PHP, so there's likely a lot of stuff that can be done better.
Want more?
So you've read this post and you're still not satisfied? Ok then, here's some other stuff for you to do: