Skip to content

ImRehmankhan/nextcodehub

Repository files navigation

NextCodeHub - Modern Web Development Blog Platform

A production-ready blog platform built with Next.js 15, Prisma, PostgreSQL, and Tailwind CSS. Features include user authentication, commenting system, like/dislike functionality, admin dashboard, and SEO optimization.

πŸš€ Features

Content Management

  • βœ… Full-featured blog with categories and tags
  • βœ… Rich text content with code syntax highlighting
  • βœ… Featured images and post excerpts
  • βœ… Related posts recommendations
  • βœ… View counter and engagement metrics

User Features

  • βœ… User authentication (signup/login)
  • βœ… Like/dislike blog posts
  • βœ… Comment on blog posts
  • βœ… User profile with avatar
  • βœ… Role-based access control

Admin Dashboard

  • βœ… Secure admin authentication with NextAuth
  • βœ… Manage blog posts (create, edit, delete)
  • βœ… Manage categories and tags
  • βœ… User management
  • βœ… Analytics dashboard

SEO & Performance

  • βœ… Dynamic sitemap.xml generation
  • βœ… Robots.txt configuration
  • βœ… JSON-LD structured data
  • βœ… Open Graph and Twitter Card meta tags
  • βœ… Mobile-responsive design
  • βœ… Server-side rendering (SSR)
  • βœ… Optimized for Google Search Console

Design

  • βœ… Modern, clean UI with Tailwind CSS v4
  • βœ… Dark/Light theme toggle
  • βœ… Gradient accents and smooth animations
  • βœ… Professional navbar with user dropdown
  • βœ… Responsive footer with internal links
  • βœ… Mobile-first responsive design

πŸ› οΈ Tech Stack

πŸ“‹ Prerequisites

  • Node.js 18+ installed
  • PostgreSQL database (local or cloud)
  • npm or yarn package manager

πŸš€ Getting Started

1. Clone the repository

git clone https://github.com/YOUR-USERNAME/nextcodehub.git
cd nextcodehub

2. Install dependencies

npm install

3. Setup environment variables

Create a .env file in the root directory:

# Database
DATABASE_URL="postgresql://postgres:password@localhost:5432/nextcodehub?schema=public"

# NextAuth
NEXTAUTH_SECRET="your-secret-key-here"
NEXTAUTH_URL="http://localhost:3000"

# Site URL
NEXT_PUBLIC_SITE_URL="http://localhost:3000"

Generate NEXTAUTH_SECRET:

openssl rand -base64 32

4. Setup database

# Generate Prisma Client
npx prisma generate

# Push database schema
npx prisma db push

# Seed database with sample data
npx prisma db seed

5. Run development server

npm run dev

Open http://localhost:3000 to see your application.

πŸ—‚οΈ Project Structure

nextcodehub/
β”œβ”€β”€ prisma/
β”‚   β”œβ”€β”€ schema.prisma       # Database schema
β”‚   └── seed.js             # Database seed file
β”œβ”€β”€ public/                 # Static assets
β”œβ”€β”€ src/
β”‚   β”œβ”€β”€ app/
β”‚   β”‚   β”œβ”€β”€ layout.js       # Root layout with metadata
β”‚   β”‚   β”œβ”€β”€ page.js         # Home page
β”‚   β”‚   β”œβ”€β”€ blog/           # Blog pages
β”‚   β”‚   β”œβ”€β”€ about/          # About page
β”‚   β”‚   β”œβ”€β”€ contact/        # Contact page
β”‚   β”‚   β”œβ”€β”€ tools/          # Tools page
β”‚   β”‚   β”œβ”€β”€ admin/          # Admin dashboard
β”‚   β”‚   β”œβ”€β”€ api/            # API routes
β”‚   β”‚   β”œβ”€β”€ sitemap.js      # Dynamic sitemap
β”‚   β”‚   └── robots.js       # Robots.txt
β”‚   β”œβ”€β”€ components/
β”‚   β”‚   β”œβ”€β”€ viewer/         # Public-facing components
β”‚   β”‚   β”œβ”€β”€ admin/          # Admin components
β”‚   β”‚   └── ui/             # Reusable UI components
β”‚   β”œβ”€β”€ lib/
β”‚   β”‚   β”œβ”€β”€ prisma.js       # Prisma client singleton
β”‚   β”‚   β”œβ”€β”€ auth.js         # NextAuth configuration
β”‚   β”‚   └── useful.js       # Utility functions
β”‚   └── styles/
β”‚       └── globals.css     # Global styles
β”œβ”€β”€ .env.example            # Example environment variables
β”œβ”€β”€ vercel.json             # Vercel configuration
β”œβ”€β”€ DEPLOYMENT.md           # Deployment guide
└── package.json

πŸ” Admin Access

Default admin credentials (change after first login):

  • URL: /admin/login
  • Email: admin@nextcodehub.com
  • Password: admin123 (stored with bcrypt hash)

πŸ“± Pages

  • / - Home page with latest posts
  • /blog - All blog posts with filters
  • /blog/[slug] - Individual blog post
  • /about - About page
  • /contact - Contact page with form
  • /tools - Developer tools (coming soon)
  • /privacy-policy - Privacy policy
  • /terms-of-service - Terms of service
  • /disclaimer - Disclaimer
  • /admin - Admin dashboard (requires authentication)

🎨 Customization

Theme Colors

Edit src/styles/globals.css to customize theme colors:

--blog-primary: 59 130 246;      /* Blue */
--blog-secondary: 147 51 234;    /* Purple */

Logo & Branding

Replace logo in src/components/viewer/navbar.js and footer.js

πŸ“¦ Database Schema

Main models:

  • User: User accounts with roles (USER/ADMIN)
  • Post: Blog posts with content, metadata
  • Category: Post categories (many-to-many with Post)
  • Tag: Post tags (many-to-many with Post)
  • Comment: User comments on posts

🚒 Deployment to Vercel

Detailed deployment instructions are available in DEPLOYMENT.md

Quick Deploy:

  1. Push code to GitHub
  2. Import project to Vercel
  3. Add environment variables
  4. Deploy!

Deploy with Vercel

πŸ”§ Scripts

npm run dev          # Start development server
npm run build        # Build for production
npm start            # Start production server
npm run lint         # Run ESLint

🀝 Contributing

Contributions are welcome! Please feel free to submit a Pull Request.

πŸ“„ License

This project is open source and available under the MIT License.

πŸ™ Acknowledgments

  • Built with Next.js
  • UI inspired by modern blog platforms
  • Icons from Lucide

πŸ“ž Support


Made with ❀️ using Next.js & Prisma

About

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published