Skip to content

The application is built using Next.js App Router and follows a modern full-stack architecture, where the frontend and backend coexist in a single codebase. Users can create accounts using email/password authentication as well as OAuth providers (GitHub and Google) through NextAuth.

License

Notifications You must be signed in to change notification settings

Erangamadhushan/User-Blog-Combo

Repository files navigation

Blogify

๐Ÿ“ User Blog Platform

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.


๐Ÿ“Œ Table of Contents

  • Overview
  • Features
  • Tech Stack
  • Project Structure
  • Screenshots
  • Getting Started
  • Environment Variables
  • Database Setup
  • Authentication
  • API Routes
  • Markdown Blogging
  • Middleware & Security
  • Future Improvement
  • License
  • Licence

๐Ÿ“– Overview

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

โœจ Features

  • 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

๐Ÿงฑ Tech Stack

Frontend

  • Next.js (App Router)
  • React
  • Tailwind CSS
  • shadcn/ui

Backend

  • Next.js APP Routes
  • NextAuth
  • Prisma ORM

Database

  • PostgreSQL
  • Supabase (on going...)

Other Tools

  • react-markdown
  • remark-gfm
  • date-fns

๐Ÿ—‚๏ธ Project Structure

  • Finalize soon...

๐Ÿ–ผ๏ธ Screenshots

Home Page

Home Page

About Page

About Page

Contact Page

Blog Page

Login Page

Login Page

Register Page

Register Page

๐Ÿš€ Getting Started

1๏ธโƒฃ Clone the repository

git clone https://github.com/Erangamadhushan/User-Blog-Combo.git

2๏ธโƒฃ Install dependencies

npm install

๐Ÿ” Environment Variables

Create 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

๐Ÿ—„๏ธ Database Setup

  1. Ensure PostgreSQL is running locally
  2. Run Prisma migrations:
npx prisma migrate dev
  1. (Optional) Open Prisma Studio:
npx prisma studio

Run Prisma migrations:

Authentication is handled using NextAuth with:

  • Credentials (email & password)
  • OAuth providers (GitHub, Google)

JWT-based sessions are used to support middleware and route protection.

โœ๏ธ Markdown Blogging

  • Blog content is written in Markdown
  • Rendered using react-markdown
  • Code blocks are syntax highlighted

๐Ÿ›ก๏ธ Middleware & Security

  • Protected routes using NextAuth middleware
  • API routes validate authentication server-side

๐Ÿ”ฎ Future Improvements

  • Blog editing and drafts
  • Comment System
  • Like System(on going...)
  • Slug-based URLs
  • Image uploads in Markdown

๐Ÿ“„ License

This project is licensed under the MIT License.

๐Ÿ™Œ Acknowledgements

  • Next.js (V16)
  • Prisma (V6.19.0)
  • NextAuth
  • Tailwind CSS(^4.1.x) -shadcn/ui

About

The application is built using Next.js App Router and follows a modern full-stack architecture, where the frontend and backend coexist in a single codebase. Users can create accounts using email/password authentication as well as OAuth providers (GitHub and Google) through NextAuth.

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Contributors 2

  •  
  •