How I Built a Blog System Into My Portfolio (And Why I Did It)
How I built a simple blog system into my portfolio using a custom API, MongoDB, and markdown—so I can write and publish from anywhere.
So here's the thing — I wanted to write blogs, but I didn't want to deal with the usual hassle.
You know the drill:
- logging into a CMS
- clicking through menus
- fighting with formatting
I just wanted to write and publish from anywhere.
That’s when I thought: why not build my own blog API?
The Problem I Was Trying to Solve
My portfolio was looking good. Clean design, dark mode, all the usual stuff a developer portfolio has.
But something was missing — a place to share what I'm learning, building, and breaking.
I could’ve used Medium or Dev.to. That would’ve been easy.
But I wanted:
- the content on my site
- on my domain
- with my design
- and my rules
The real catch?
I didn’t want to open VS Code every time I wanted to write a blog.
I wanted to post from Postman, from my phone, from anywhere.
Building the API
So I built a simple REST API.
Here’s what it does:
- POST /api/blog → creates a new blog post
- GET /api/blog → fetches all published posts (with pagination)
The POST endpoint is protected by a password header. Nothing fancy — just enough so random people can’t flood my blog with spam.
The blog content itself is pure markdown.
I:
- write in markdown
- store it in MongoDB
- render it on the frontend
Simple and flexible.
Here’s roughly what the request looks like:
{
"title": "My First Real n8n Workflow",
"body": "# Your markdown content here...",
"description": "A short description",
"tags": ["n8n", "Automation"],
"isStarred": true
}
Send this with the right password header — and boom. The blog is live.
Why MongoDB?
Initially, I tried storing blogs as local markdown files.
It worked perfectly on localhost.
Then I deployed to Vercel… and reality hit.
Vercel’s serverless functions run on a read-only filesystem.
So that approach died immediately.
I switched to MongoDB, and everything clicked:
- blogs live in the database
- I can create, read, or update them from anywhere
- the API just talks to MongoDB
If you’re building something similar — save yourself the headache and use a database from day one.
The Frontend Features
The blog section isn’t just a dumb list of posts. I added a few things to make it actually usable:
-
Search
Filters posts by title, description, or tags. It’s debounced, so the API doesn’t get hammered on every keystroke. -
Pagination
20 posts per page, with sliding window pagination. The numbered buttons shift as you navigate. -
Curated Section
Starred posts show up in a sidebar on desktop, and a slide-in drawer on mobile. These are the posts I want people to see first. -
Consistent Cards
Every blog card has the same height. Descriptions are truncated so the layout stays clean.
Nothing revolutionary — but it feels polished.
The Part About Writing
Here’s the honest part.
My rough notes are chaos.
Random thoughts, half sentences, typos, voice-note energy — not something you’d want to publish directly.
So I built a small system for myself.
I dump my rough notes into ChatGPT and tell it:
“You’re my technical blog writer. Turn this into something readable.”
It takes the mess and gives me a clean, human-friendly draft.
I review it, tweak it, and publish.
This blog you’re reading? It started as rough notes about what I built today.
Things I Learned
A few lessons stood out while building this:
-
Vercel’s filesystem is read-only
Learned this the hard way. Don’t try to write files inside serverless functions. -
Mongoose caching matters
In development, MongoDB connections can get recreated on every hot reload. Cache them properly or you’ll run into memory issues. -
Dynamic metadata is powerful
Each blog has its own Open Graph tags. Share a link on WhatsApp and it shows the correct title and description. Small detail, big impact. -
Start with an API
Even for a personal site, an API gives you flexibility. I can automate posts, integrate tools, or even build a mobile app later.
What’s Next
I want to hook this up with n8n or some automation tool.
The idea is simple:
- write a note
- send it to an AI
- get a draft
- review it
- auto-publish to my portfolio
All without opening a browser.
With this API in place, that’s actually doable.
Wrapping Up
If you’re a developer thinking about starting a blog — build something simple.
You don’t need Gatsby or a heavy headless CMS.
A Next.js API route, MongoDB, and markdown rendering goes a long way.
The code for all of this is on my GitHub. Feel free to poke around.
If you made it this far — thanks for reading.
Now go build something.
Happy learning, and Namaste 🙏
— Omkar Chebale