A full-stack user + Blog Platform built with Next.js App Router, Prisma, and PostgreSQL, where users can authenticate and publish Markdown-based blog posts similar to writing a README.md.
- Overview
- Features
- Tech Stack
- Project Structure
- Screenshots
- Getting Started
- Environment Variables
- Database Setup
- Authentication
- API Routes
- Markdown Blogging
- Middleware & Security
- Future Improvement
- License
- Licence
This project is a modern blogging platform that allows users to:
- Register and log in using credentials or OAuth(Google, GitHub)
- Create and publish blogs using Markdown
- Preview blog content live before publishing
- View blogs rendered with syntax highlighting and table of contents
- Access protected routes securely
- User authentication with NextAuth
- Email/password and OAuth login (GitHub & Google)
- JWT-based session handling
- Protected routes using middleware
- Markdown-based blog editor (README-style)
- Live Markdown preview with TOC
- Syntax-highlighted code blocks
- Human-readable timestamps (e.g. "2 hours ago")
- Responsive UI using Tailwind CSS & shadcn/ui
- Light/Dark Themes
- Next.js (App Router)
- React
- Tailwind CSS
- shadcn/ui
- Next.js APP Routes
- NextAuth
- Prisma ORM
- PostgreSQL
- Supabase (on going...)
- react-markdown
- remark-gfm
- date-fns
- Finalize soon...
git clone https://github.com/Erangamadhushan/User-Blog-Combo.git
npm installCreate a .env.local file
DATABASE_URL=postgresql://user:password@localhost:5432/blogdb
NEXTAUTH_SECRET=your-secret-key
NEXTAUTH_URL=http://localhost:3000
GITHUB_CLIENT_ID=your-github-client-id
GITHUB_CLIENT_SECRET=your-github-client-secret
GOOGLE_CLIENT_ID=your-google-client-id
GOOGLE_CLIENT_SECRET=your-google-client-secret- Ensure PostgreSQL is running locally
- Run Prisma migrations:
npx prisma migrate dev- (Optional) Open Prisma Studio:
npx prisma studioAuthentication is handled using NextAuth with:
- Credentials (email & password)
- OAuth providers (GitHub, Google)
JWT-based sessions are used to support middleware and route protection.
- Blog content is written in Markdown
- Rendered using
react-markdown - Code blocks are syntax highlighted
- Protected routes using NextAuth middleware
- API routes validate authentication server-side
- Blog editing and drafts
- Comment System
- Like System(on going...)
- Slug-based URLs
- Image uploads in Markdown
This project is licensed under the MIT License.
- Next.js (V16)
- Prisma (V6.19.0)
- NextAuth
- Tailwind CSS(^4.1.x) -shadcn/ui





