Overview

ENGINEERINGBLOGIFY CMS

Table of Contents

The 'Hello World' of Backend Engineering
What Broke: The Orphan Asset NightmareEditorial Design in Raw EJSStateless JWTs & Secure Cookie AuthLaying the Groundwork for Bigger Systems

The 'Hello World' of Backend Engineering

They say a blogging platform is the classic 'Hello World' of backend development. When I set out to build Blogify, I didn't want a generic tutorial clone; I wanted to build the absolute most polished, production-grade version of that foundation.

I chose to build it without modern frontend frameworks like React or Next.js. Instead, I dove deep into raw Server-Side Rendering (SSR) using Node.js, Express, and EJS templates. I wanted to understand how a server prepares data, authenticates cookies, and renders complete HTML before a single byte ever reaches the client browser.

What Broke: The Orphan Asset Nightmare

The biggest technical headache on this project was managing media lifecycles. When authors wrote posts, they would upload cover images, change their mind, upload a different image, or delete the post entirely.

Initially, new uploads simply overwrote the database reference, leaving old images sitting on Cloudinary indefinitely as 'orphaned assets' consuming paid storage. I engineered an asset cleanup hook inside the Mongoose middleware. Whenever a post is updated with a new image or deleted, the backend extracts the previous asset's public ID and triggers an automated Cloudinary destruction call, keeping the storage completely garbage-collected.

Editorial Design in Raw EJS

Creating a sleek, minimalist editorial aesthetic in React with component libraries is straightforward. Doing it in raw EJS and TailwindCSS without client-side state hydration was a completely different challenge.

I structured the frontend into modular EJS partials (head, nav, footer, editor-picks), keeping the templates DRY while delivering an editorial magazine feel. TinyMCE was integrated seamlessly with local storage autosave, ensuring writers never lose their drafts even if the browser crashes.

Stateless JWTs & Secure Cookie Auth

Blogify was my first rigorous implementation of stateless JWT authentication. Rather than storing tokens in insecure localStorage where they are vulnerable to XSS attacks, I configured tokens to be passed exclusively via HTTP-only, SameSite cookies.

The Express middleware intercepts every request, validates the token signature, and attaches the authenticated user object directly to res.locals, allowing EJS templates to conditionally render author controls seamlessly on the server.

Laying the Groundwork for Bigger Systems

Building Blogify proved that even foundational software demands high engineering standards. Mastering server-side data flow, caching, and asset lifecycles here directly laid the architectural groundwork for the complex AI video pipelines and real-time mobile game engines I built afterward.