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: admin@mail.com
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!