Thanks to visit codestin.com
Credit goes to github.com

Skip to content

THEFZNKHAN/nextblog

Repository files navigation

πŸš€ NextBlog β€” Modern Blog Platform

Next.js React MongoDB Tailwind CSS Vercel

A clean, modern, and responsive blogging platform.
Built with Next.js 14, MongoDB Atlas, Tailwind CSS, and React-Quill.


🏠 Home Page

Home Page


πŸ›‘οΈ Admin Dashboard

Admin Dashboard Page


πŸ“ Create Post

Create Post Page


πŸ”‘ Admin Login

Admin Login Page


πŸ” Quick Admin Access

Test Admin Account:
Email: [email protected]
Password: admin@123


✨ Features

  • πŸ–ΌοΈ Beautiful UI: Glassmorphism, smooth animations, mobile-first
  • πŸ” Secure Admin Auth: NextAuth.js + bcrypt, JWT sessions
  • ✍️ Rich Content: WYSIWYG editor, SEO-friendly slugs
  • πŸ—‚οΈ Full CRUD: Publish, update, delete posts (admin)
  • ⚑ SEO & Performance: SSR, image optimization, dynamic meta tags
  • πŸ‘¨β€πŸ’» Dev Experience: TypeScript, clean architecture, error handling

πŸš€ Quick Start

Show Setup Instructions

Prerequisites

  • Node.js v18+
  • MongoDB Atlas (free-tier)
  • Git

1. Clone & Install

git clone https://github.com/thefznkhan/nextblog.git
cd nextblog
npm install

2. Configure Environment

Create .env.local:

MONGODB_URI=your-mongodb-connection-string
NEXTAUTH_URL=http://localhost:3000
NEXTAUTH_SECRET=your-32-byte-secret
NEXT_PUBLIC_BASE_URL=http://localhost:3000

3. Start Development

npm run dev

Visit http://localhost:3000


🧩 Tech Stack

Tool Purpose
Next.js 14 Full-stack React framework
React 18 Frontend library
MongoDB Cloud database
Mongoose MongoDB ODM
NextAuth.js Authentication
React-Quill Rich text editing
Tailwind CSS Styling
bcryptjs Password hashing

πŸ“š API Overview

Show API Endpoints

Posts

  • GET /api/posts β€” List all posts
  • POST /api/posts β€” Create post (admin)
  • GET /api/posts/[slug] β€” Get single post
  • PUT /api/posts/[slug] β€” Update post (admin)
  • DELETE /api/posts/[slug] β€” Delete post (admin)

Admin

  • GET /api/admin/setup β€” Check if admin exists
  • POST /api/admin/setup β€” Create initial admin

πŸ› οΈ Configuration Tips

  • MongoDB: Whitelist your IP in Atlas
  • NEXTAUTH_SECRET: Must be consistent for sessions
  • Tailwind: Customize in tailwind.config.js

πŸ†˜ Troubleshooting

  • MongoDB connection error: Check .env.local, whitelist IP
  • NextAuth JWT errors: Ensure NEXTAUTH_SECRET is set, clear cookies
  • Tailwind issues: Run rm -rf .next and restart

🀝 Contribution Guide

  1. Fork the repo
  2. Branch: git checkout -b feat/your-feature
  3. Develop & Test
  4. Lint/Test: npm run lint && npm test
  5. Pull Request

πŸ“ License & Credits

This project is MIT licensed β€” see LICENSE.
Thanks to the Next.js, MongoDB, Tailwind CSS, and React-Quill communities!


Made with ❀️ by THEFZNKHAN.
If you enjoy this project, please ⭐ star on GitHub!