A full-stack blog application built with the MERN stack (MongoDB, Express, React, Node.js) featuring user authentication, blog post management, and a modern UI.
- 🔐 User authentication with JWT
- ✍️ Create, read, update, and delete blog posts
- 🎨 Modern and responsive UI with Tailwind CSS and Flowbite
- 🔥 Firebase integration
- 📱 Mobile-friendly design
- 🔄 State management with Redux Toolkit
- Node.js - Runtime environment
- Express. js - Web framework
- MongoDB - Database
- Mongoose - MongoDB object modeling
- JSON Web Tokens (JWT) - Authentication
- bcryptjs - Password hashing
- React - UI library
- Vite - Build tool
- Redux Toolkit - State management
- React Router - Navigation
- Tailwind CSS - Styling
- Flowbite React - UI components
- Firebase - Additional services
Blog/
├── api/ # Backend code
│ ├── controllers/ # Route controllers
│ ├── models/ # Database models
│ ├── routes/ # API routes
│ ├── utils/ # Utility functions
│ └── index. js # Server entry point
├── client/ # Frontend code
│ ├── src/ # React source files
│ ├── public/ # Static files
│ └── index.html # HTML entry point
└── package.json # Root dependencies
- Node.js (v14 or higher)
- MongoDB
- npm or yarn
-
Clone the repository
git clone https://github.com/harshala334/Blog.git cd Blog -
Install backend dependencies
npm install-
Install frontend dependencies
cd client npm install cd ..
-
Environment Variables
Create a
.envfile in the root directory and add:MONGODB_URI=your_mongodb_connection_string JWT_SECRET=your_jwt_secret_key PORT=3000Create a
.envfile in the client directory for Firebase configuration:VITE_FIREBASE_API_KEY=your_firebase_api_key VITE_FIREBASE_AUTH_DOMAIN=your_firebase_auth_domain VITE_FIREBASE_PROJECT_ID=your_firebase_project_id VITE_FIREBASE_STORAGE_BUCKET=your_firebase_storage_bucket VITE_FIREBASE_MESSAGING_SENDER_ID=your_firebase_messaging_sender_id VITE_FIREBASE_APP_ID=your_firebase_app_id
-
Start the backend server
npm run dev
The API server will run on
http://localhost:3000(or your specified PORT) -
Start the frontend development server
cd client npm run devThe React app will run on
http://localhost:5173
-
Build the frontend
cd client npm run build -
Start the backend server
npm start
npm run dev- Run the server with nodemon (auto-restart on changes)npm start- Run the server in production mode
npm run dev- Start development servernpm run build- Build for productionnpm run preview- Preview production buildnpm run lint- Run ESLint
The API provides endpoints for:
- User authentication (signup, login)
- Blog post CRUD operations
- User profile management