P-Blog is an open-source personal blog template that pairs a Next.js frontend with a Node.js REST API and MongoDB database, giving developers a ready-to-run blog plus an admin CMS in one repository.
What is P-Blog?
P-Blog is a personal blogging setup consisting of two separate apps: a public frontend blog and an admin CMS. The repository uses Next.js for the frontend websites and a Node.js REST API for each side, with MongoDB as the data store. It supports PWA (Progressive Web App) features. The project is maintained by Krehwell, with a live demo at https://krehwell.com.
Key Features
- Split frontend/admin architecture — the repo contains separate
frontend/andadmin/folders, each with its ownwebsite/(Next.js) andrest-api/(Node.js) components. - Custom headless-style CMS — the admin site uses server-side rendering and lets you create, modify, or delete blog posts, which are stored in MongoDB.
- MongoDB integration — connection is configured through environment variables (DB_USERNAME and DB_PASSWORD) and a MongoDB connection string in each rest-api's index.js.
- REST API routing — each backend exposes routes like
/posts/get-all-blog-poststhat call API handler modules for database fetching. - Utility helpers for API base URLs — the frontend includes a
Utils/apiBaseUrl.jshelper to switch between localhost and production server URLs. - PWA support — the README states the template supports Progressive Web App capabilities.
- API function separation — frontend code keeps all data-fetching functions in an
api/directory, so pages importgetAllBlogPost.jsand similar helpers rather than calling MongoDB directly. - Server-side rendering for admin — all admin pages use SSR, per the README.
Who is it for?
- Developers who want a personal blog with a custom CMS — they get a fully wired blog plus admin panel that they can deploy and connect to their own MongoDB instance.
- Next.js learners — the codebase shows a clear pattern for separating API routes, utility helpers, and page components in a Next.js app.
- Developers who want a two-app repo structure — individuals or teams who prefer keeping the public blog and admin CMS in isolated folders with independent Node backends.
What can you do with P-Blog?
- Start a personal blog: clone the repo, set MongoDB env vars, and run the frontend and admin apps to publish posts from the CMS.
- Customize the post workflow: modify the
api.jshandler inroutes/to change how blog posts are queried from MongoDB. - Deploy frontend and admin separately: because the two sides are independent apps, you could host the blog on one service and the admin APIs on a Node server.
How does P-Blog work?
The template is run by configuring a .env file in each rest-api/ directory with MongoDB credentials, then updating the MongoDB connection string in rest-api/index.js to match your cluster. The frontend and admin sites fetch data through their own REST APIs, and the admin CMS provides a UI for managing blog posts.





