The GenPost is a modern, AI-enhanced blogging platform built with Next.js, MongoDB, and Tailwind CSS. It features a robust admin dashboard, AI content generation using Google Gemini, automated image sourcing via Unsplash, and privacy-focused analytics.
- Modern Tech Stack: Built with Next.js 14 (App Router), TypeScript, and Tailwind CSS.
- AI Content Generation: Integrated with Google Gemini to generate article drafts and ideas.
- Image Integration: Integrated with Unsplash API for automatic cover image fetching.
- Admin Dashboard: comprehensive admin panel to manage posts, topics, and settings.
- Analytics: Built-in privacy-first analytics tracking views, unique visitors, and country data.
- Contact System: Functional contact form with admin notifications and "mark as read" functionality.
- Responsive Design: Fully responsive UI with Dark/Light mode support.
- SEO Optimized: Dynamic metadata and SEO-friendly structure.
- Framework: Next.js
- Database: MongoDB (via Mongoose)
- Styling: Tailwind CSS
- Icons: Lucide React
- AI: Google Gemini API
- Images: Unsplash API
- Node.js 18+
- MongoDB Database
-
Clone the repository
git clone https://github.com/Parthakashyap/GenPost.git cd GenPost -
Install dependencies
npm install
-
Environment Setup Create a
.env.localfile in the root directory and add the following variables:MONGODB_URI=your_mongodb_connection_string JWT_SECRET=your_jwt_secret_key GEMINI_API_KEY=your_gemini_api_key UNSPLASH_ACCESS_KEY=your_unsplash_access_key NEXT_PUBLIC_APP_URL=http://localhost:3000
-
Run the development server
npm run dev
Open http://localhost:3000 with your browser to see the result.
app/: Next.js App Router pages and API routes.components/: Reusable UI components.lib/: Utility functions and database connection.models/: Mongoose schemas (Post, Analytics, ContactMessage, etc.).public/: Static assets.
The admin panel is located at /admin. You will need to create an admin account in your database.
This project includes a GitHub Action workflow (.github/workflows/cron.yml) to automate content generation.
To use the automated workflow, you need to set up the following GitHub Secrets in your repository settings:
VERCEL_PROJECT_PRODUCTION_URL: The full URL of your production deployment (e.g.,https://your-blog.vercel.app).CRON_SECRET: A secret key used to authenticate the cron job request. This must match theCRON_SECRETenvironment variable in your Vercel deployment.
- Trigger Cron Job: This workflow runs automatically every hour (
0 * * * *) to trigger the content generation API endpoint.- It can also be triggered manually from the "Actions" tab in GitHub.
- Manual Inputs:
force: (Boolean, default:true) If set totrue, it forces generation even if the schedule criteria aren't met.
This project is licensed under the MIT License.