OO
All work

Live

NodeJs Blog

A portfolio backend project: a blog rendered with EJS, stored in MongoDB, with search and a protected admin for creating and editing posts.

  • Node.js
  • Express
  • MongoDB
  • Mongoose
  • EJS
  • JWT
  • bcrypt
NodeJs Blog website
Visit the site — nodejs-blog-delta.vercel.app

/ Problem

I needed a backend training project that is more than a login screen: public pages, a data model for posts, search, and an admin that is closed unless you are signed in.

/ My role

I built this as a learning project. Express owns the routes. EJS renders the pages. MongoDB holds the data. I deployed it on Vercel.

/ What I built

  1. 01Public pages for home, about, and contact, rendered on the server with EJS.
  2. 02A search form that posts to /search.
  3. 03An /admin page with login and registration forms.
  4. 04A token cookie. /dashboard and /add-post redirect to /admin when there is no session. /logout clears the cookie.
  5. 05The about page states the rest of the training stack: Mongoose, JWT, bcrypt, pagination, and a protected admin CRUD dashboard.

This is a training project, not a client blog. I did not log into the admin, so create/edit/delete of posts is described from the routes and the about page, not from a session I opened. Pagination is part of the build; it is not visible on the public home page with the current posts.

/ One hard part

Keep write routes behind a session

Anyone can read the blog. Adding a post is a different job. Dashboard and add-post send you to /admin until a token cookie is present, so the public site and the write UI do not share the same access.