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
| Role | Can do |
|--------|--------|
| Owner | Manage users, delete any post, full admin |
| Author | Create, edit, and delete their own posts |
| Reader | Browse 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