Why I Added Backend to My Developer Blog

When I first started building Nikolas Dev Journey, I focused purely on the frontend. It was a great way to get started with React and design a clean interface. But as I planned to add more dynamic content like blog posts, comments, and future project updates, I realized I needed a backend to fetch and manage data properly.

Benefits of Adding a Backend

  • Dynamic Content: Blog posts are now fetched from an API, not hardcoded.
  • Scalability: Easier to connect to a real database later.
  • Cleaner Logic: Separation of content and layout makes maintenance simpler.
  • API Routes: I used /app/api/blog/route.js to return structured JSON data for my blog.

Folder Structure Update

/app /api /blog route.js ← returns blog posts /blog page.js /posts /why-i-added-backend page.js

Connecting API + Frontend

On the /blog page, I fetch all blog posts using fetch("/api/blog"). This lets me render new posts automatically just by updating the backend response , no need to manually edit the page.

What I Gained

  • More dynamic and scalable blog architecture
  • Practice with API design and separation of concerns
  • Easier to add real CMS or database in the future
“This small shift toward backend logic opened a lot of new possibilities.”

💬 Comments & Discussion

Share your thoughts, ask questions, or discuss this post. Comments are powered by GitHub Discussions.