A personal API
Over the past year, I've steadily been moving all my content from markdown to a more structured format based on the TipTap editor.
The first few pages were done by hand, and slowly I built out a Ruby script to take care of the more mundane stuff, and eventually, I could migrate everything automatically.
The goal was to move this content to my "Personal API" (I use the term loosely here). I want a single point where I can feed content that eventually gets published on my site.
Why structured content?
The threshold of publishing something on my static site was just too high:
Write the thing in IA Writer
Upload the photos/images somehow
Make sure the font matter is correct in VsCode
And finally, push the code to trigger a deployment.
And this was just for "simple" blog posts. The trips section had so much custom markdown; it almost was its own language.
I had custom markdown to generate:
Bunny CDN Videos
And much more. (it even incorporated hotels and flight bookings for a few months).
All this custom markdown was hard to debug and nowhere near as portable as vanilla or GitHub-flavored markdown, and we all know we developers like to change language/cms for our personal sites every year at least.
I wanted structured content to guarantee it would be rendered correctly and a visual CMS to conveniently write posts and trips. Ideally, it would accept multiple input methods that could be expanded upon.
At this time, pocketbase was released. A single-file CMS, which is a wrapper around SQLite that adds authorization and an interface to create tables/fields.
It was a great base to start from; it prevented me from overthinking the project and focus on converting the content first. Starting with the manual migration and, later on, the automated Ruby script that took my heavily rewritten markdown parser to emit JSON instead of HTML.
Once the data was in the CMS, I could render it with a rewritten SvelteKit project to generate a static site. (Later converted to Bridgetownrb when SvelteKit changed the routing, and half the site didn't work anymore).
For the input side, I wrote a small CMS based on the TipTap editor that would generate the JSON structure for the content. I researched other JSON formats, but TipTap seemed the easiest to add new types and had actual implementations in many languages instead of just a document describing the format.
Now having an endpoint to add content, I could begin adding additional methods of input, such as my Telegram bot to create notes and trip check-ins. This has already improved my posting habit by a ton!
So you're done, right... right?
This has been running great for the past year, but the way I manage my assets differs from what Pocketbase does (I want to resize my images while uploading and not lazy-loaded on request, for example).
This is especially important to me, as a single trip log contains hundreds of photos, and I care about serving the right size using Picture tags and src-sets.
Over time the plan slowly started to brew to move the code to Rust using Axum and the same Sqlite database that contains the current content. No migration is needed. And how that project goes will be the subject of many future posts (hopefully).