Over the past few days, I built a blog engine from scratch β€” no WordPress, no plugins, no heavy CMS bloat. Just clean PHP, MySQL, and full control over everything from how posts are rendered to how they're stored and displayed. Here’s a quick breakdown of how I structured it and why.


πŸ“‚ Folder Structure

Everything lives under my /var/www/html/test directory. Here's a simplified breakdown:

/test
β”œβ”€β”€ assets/          # CSS, JS, shared images
β”œβ”€β”€ blog/
β”‚   β”œβ”€β”€ admin/       # Password-protected post form + upload handler
β”‚   β”œβ”€β”€ images/      # Blog post images (organized by post-XXXX folders)
β”‚   β”œβ”€β”€ index.php    # Blog homepage
β”‚   β”œβ”€β”€ post.php     # Individual post view
β”œβ”€β”€ includes/        # Header, footer, DB connection (secured)
β”œβ”€β”€ pages/           # Main site pages (about, services, etc.)
β”œβ”€β”€ index.php        # Site landing page

🧠 Database Design

All content is stored in a simple dfg_blog MySQL database with the following key tables:

  • posts β€” id, title, summary, content, published_at
  • comments (for future use)
  • tags and post_tags (for filtering, also planned)

Every blog post gets a unique ID, which is also used to generate its image storage path, like:

/blog/images/posts/post-0001/

πŸ› οΈ Admin Panel

I built a lightweight admin panel with:

  • Password protection
  • A form to create new posts
  • Support for image uploads (stored in the correct folder automatically)

The post ID is determined dynamically based on the last post, so everything stays sequential without duplicates.


βœ… Why I Chose This Path

I wanted complete ownership of my content and layout. This setup lets me:

  • Edit everything locally or via my admin form
  • Keep my codebase clean and version-controlled
  • Add features gradually without relying on plugins or third-party services

It’s also a great exercise in practical web development and backend structure.


πŸ§ͺ What’s Next

  • Markdown-style formatting in the editor
  • Tag-based navigation
  • Optional comments and reactions
  • More Merlin, obviously 🐾

πŸ’¬ Final Thoughts

If you’ve ever wanted to build your own blog engine β€” not just a theme β€” this approach is a great way to get your hands dirty and understand how things work under the hood. And yeah... it’s way more fun when your dog helps write posts. πŸ˜‰

🐾 Merlin’s Corner

Merlin

"Hey there, humans. Merlin here β€” I watched this whole thing get built from scratch, and lemme tell you, it smelled like hard work and PHP. No WordPress? No problem. Just clean code, sharp instincts, and plenty of water breaks. I’m proud of how this blog came together... and the folder structure is tighter than my leash on squirrel patrol. πŸ•β€πŸ¦Ί Now fetch yourself some inspiration and try building something too!"