A modern, feature-rich blog platform built with Node.js and MongoDB. This project demonstrates a full-stack web application with user authentication, CRUD operations, and responsive design.
-
User Authentication
- Secure login and signup system
- JWT-based authentication
- Protected routes for authenticated users
-
Blog Management
- Create, read, update, and delete blog posts
- Author attribution for posts
- Timestamp for post creation
-
User Experience
- Responsive design using Bootstrap
- Clean and intuitive user interface
- Pagination for better content navigation
- Confirmation dialogs for destructive actions
-
Security
- Password hashing using bcrypt
- Protected routes and actions
- Secure cookie handling
- Input validation and sanitization
Check out the live demo: Blog Website
-
Backend
- Node.js
- Express.js
- MongoDB with Mongoose
- JWT for authentication
-
Frontend
- EJS templating engine
- Bootstrap 5
- Custom CSS
- Responsive design
- Clone the repository
git clone https://github.com/ssahibsingh/blog-website.git
- Navigate to project directory
cd blog-website
- Install dependencies
npm install
- Create a
.env
file in the root directory and add your environment variables:
MONGODB_URI=your_mongodb_connection_string
JWT_SECRET=your_jwt_secret
PORT=3000
- Start the server
node app.js
Variable | Description |
---|---|
MONGODB_URI |
MongoDB connection string |
JWT_SECRET |
Secret key for JWT token generation |
PORT |
Port number for the server (default: 3000) |
POST /auth/signup
- Register a new userPOST /auth/login
- Login userGET /auth/logout
- Logout user
GET /
- Get all blog posts (paginated)GET /posts/new
- Get new post formPOST /posts/new
- Create new postGET /posts/:id
- Get single postGET /posts/:id/edit
- Get edit post formPOST /posts/:id/edit
- Update postPOST /posts/:id/delete
- Delete post
Contributions are welcome! Please feel free to submit a Pull Request.
- Fork the repository
- Create your feature branch (
git checkout -b feature/AmazingFeature
) - Commit your changes (
git commit -m 'Add some AmazingFeature'
) - Push to the branch (
git push origin feature/AmazingFeature
) - Open a Pull Request
- Sahib Singh - GitHub Profile
Give a โญ๏ธ if this project helped you!