This is a blog application built with Next.js, MongoDB, and Auth.js for authentication. The application provides users with a platform to create, edit, and view blog posts, with support for secure authentication and data persistence.
- User Authentication: Secure user authentication using Auth.js
- MongoDB Database: Stores blog posts and user data
- Next.js: Built with the Next.js framework for fast and SEO-friendly performance
- CRUD Operations: Create, Read, Update, Delete blog posts
- Responsive Design: Optimized for all devices
- Next.js: Frontend framework
- MongoDB: NoSQL database for data storage
- Auth.js: Authentication solution
- React.js: Frontend library
- CSS Modules: Styling for components
- Node.js (v16 or later)
- MongoDB: Setup a MongoDB Atlas account or a local MongoDB server
git clone https://github.com/your-username/your-repo-name.git
cd your-repo-name
npm install
Create a .env.local
file in the root directory and add the following environment variables:
# MongoDB Connection URI
MONGODB_URI=your_mongodb_connection_string
# Auth.js Secret Key
NEXTAUTH_SECRET=your_nextauth_secret
# Optional: NextAuth Provider Configuration (e.g., Google, GitHub)
NEXTAUTH_URL=http://localhost:3000
To start the application in development mode:
npm run dev
Open http://localhost:3000 to view it in the browser.
- Register/Login: Users can register and log in using Auth.js with optional providers like Google or GitHub.
- Create Blog Posts: Authenticated users can create new blog posts.
- Edit/Delete Posts: Authenticated users can edit or delete their posts.
- Read Blog Posts: All users (authenticated or not) can read available blog posts.
You can deploy this project on Vercel or any other platform that supports Next.js applications.
For deployment on Vercel, follow these steps:
- Push your code to a GitHub repository.
- Go to Vercel and connect your repository.
- Add the environment variables in the Vercel project settings.
- Deploy your application.
Feel free to open issues and submit pull requests for any improvements.
This project is open-source and available under the MIT License.
For any questions, feel free to reach out via LinkedIn.