← Portfolio

Full-Stack Blog Platform with EJS and PostgreSQL

A multi-role blog with owner, author, and reader access levels, built with server-side EJS templates and a PostgreSQL backend.

0

Full-Stack Blog Platform with EJS and PostgreSQL

A traditional server-rendered blog with multi-role access control — owner, author, and reader — built before I moved to Next.js.

Stack

  • Node.js + Express for routing and server logic
  • EJS for server-side HTML templating
  • PostgreSQL for persistent storage
  • bcrypt for password hashing
  • express-session for session management

Roles

RoleCan do
OwnerManage users, delete any post, full admin
AuthorCreate, edit, and delete their own posts
ReaderBrowse and read posts

Database Schema

Three main tables: users, posts, and sessions. Posts link to users via foreign key. Sessions use a server-side store backed by PostgreSQL.

What I Learned

Session management is trickier than it looks. Race conditions between session creation and database writes caused intermittent auth bugs early on. Moving to a proper session store fixed this.

EJS is simple and explicit — great for learning, but I quickly hit its limits for interactive UIs. This project was the reason I moved to React + Next.js.

Source: GitHub

Discussion

Sign in to leave a comment.

No comments yet. Be the first.