Skip to content
Search Journal
Search journal entries and projects across Journal.
Frontend Engineeringdeep dive

Designing Journal: A Backendless Publishing Platform

How I turned Markdown and MDX into a statically generated engineering publication with local search, progressive pagination and smooth client-side navigation.

I write articles and project notes on this site. I publish by editing files in the repo. Adding a database, admin panel and content API would add a lot of extra complexity to the publishing process.

Astro generates the pages. The MDX and Markdown files live in the repo. The collection schema validates the frontmatter, and invalid fields make the build fail in CI. Git is used for review. It’s pretty basic: the changes are diffs, and I can revert them if needed. There are no migrations. The downside is that publishing means building and deploying. There’s no live editing, but I don’t miss it.

The browser gets HTML. Svelte hydrates the header controls, search, keyboard shortcuts and the list that loads more entries as you scroll. The article content itself stays static. That split keeps the content path simple while leaving room for the parts of the site that need interaction.

Search uses a JSON index generated with the site. The header loads it during hydration, and the dialog ranks results locally. The index includes each article’s title, summary, tags, search terms, route and normalized searchable text. This lets search rank a query without loading each page. I also cache the in-flight index request and its parsed result in a WeakMap, so concurrent callers share the same work. If a request or validation fails, the rejected promise is removed from the cache and a later attempt can retry. Search ranking caches prepared document data too, rather than normalizing and tokenizing every document for every query.

The first page of the journal is useful on its own. As you scroll, more items load. I could generate a single page for the archive, but that would send the entire archive to everyone. The paginated list guards against overlapping requests, duplicate entries and repeated page URLs. It checks that a next-page URL stays on the same origin and validates the response before changing the list. Requests are aborted if the component is destroyed, and a timeout prevents one from hanging forever. These checks are mostly invisible when everything works, which is exactly where I want them.

I ran into a less obvious problem on mobile Safari. The page could paint incorrectly while the browser’s compact address bar changed size. I had to look at how scrolling was owned by the document. Moving the scroll container from the root element to the body fixed it: the html element now has a full-height, non-scrolling layout, while the body owns vertical scrolling. I moved smooth scrolling to the body at the same time. That fixed the rendering path instead of adding an animation or repaint workaround across the whole site.

For page speed, the main decision is to keep the initial response useful and small: static HTML for the content, Svelte hydration only for interactive areas, and more archive entries fetched as needed. Search is a separate generated JSON file, and its parsed data is reused. I measure the site in the browser rather than assuming static generation makes every interaction fast.

The latest Watchpoint run on Chrome recorded these results:

Metric Result
Time to First Byte (TTFB) 229 ms
First Contentful Paint (FCP) 613 ms
Largest Contentful Paint (LCP) 613 ms
Cumulative Layout Shift (CLS) 0
Total Blocking Time (TBT) 0 ms
Speed Index 638 ms
Fully loaded 1.139 s
Requests 25
Transferred 251 KB

The LCP element was the introductory paragraph in the homepage hero. The search index loaded after LCP, at around 1.14 seconds.

The typography is simple: monochrome with subtle accents. There’s no layout competing with the note. I want the site to stay quick as the archive grows, so the next useful work is to keep checking the generated page and search-index sizes, and to revisit when the index should load. Right now it loads with the header; loading it only when someone first opens search is a possible improvement if the initial cost becomes worth removing.