Skip to content

Latest commit

 

History

2 Commits

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Blog Post Platform

A full-stack blog platform built with Node.js and Express, powered by MongoDB. Create, manage, and share blog posts with a secure authentication system and rich user experience.

Features

  • User Authentication: Secure user registration and login with bcrypt password hashing
  • Blog Management: Create, read, update, and delete blog posts
  • Search Functionality: Search blog posts by keywords
  • File Uploads: Upload images and files with posts
  • Session Management: Persistent user sessions with express-session
  • Responsive Design: Clean and responsive UI with EJS templates
  • User Authorization: Middleware-based authentication and validation
  • Modern Tech Stack: Built with Express.js, MongoDB, and modern JavaScript

Tech Stack

  • Backend: Node.js, Express.js
  • Database: MongoDB with Mongoose ODM
  • Template Engine: EJS
  • Authentication: bcrypt, express-session
  • File Handling: express-fileupload
  • Parsing: body-parser
  • Development: Nodemon for hot-reloading

Project Structure

├── controllers/          # Route handlers and business logic
│   ├── getPost.js       # Retrieve individual posts
│   ├── home.js          # Home page logic
│   ├── login.js         # Login page
│   ├── loginUser.js     # Login processing
│   ├── logout.js        # Logout handler
│   ├── newPost.js       # New post form
│   ├── newUser.js       # Registration form
│   ├── search.js        # Search functionality
│   ├── storePost.js     # Save new posts
│   └── storeUser.js     # Save new users
├── middleware/          # Custom middleware
│   ├── authMiddleware.js
│   └── validationMiddleware.js
├── models/              # Database schemas
│   ├── Blogpost.js
│   └── User.js
├── views/               # EJS templates
│   ├── index.ejs
│   ├── post.ejs
│   ├── create.ejs
│   ├── login.ejs
│   ├── register.ejs
│   ├── about.ejs
│   ├── contact.ejs
│   ├── notfound.ejs
│   └── layouts/         # Layout templates
│       ├── header.ejs
│       ├── navbar.ejs
│       └── footer.ejs
├── public/              # Static files
│   ├── css/
│   ├── js/
│   └── img/
├── server.js            # Main server file
└── package.json         # Dependencies and scripts

Installation

  1. Clone the repository

    git clone <repository-url>
    cd blog-post
  2. Install dependencies

    npm install
  3. Configure environment

    • Create a .env file with your MongoDB connection string and other configurations
    • Update session secret in server.js for production
  4. Start the development server

    npm run dev

    Or start with Node directly:

    node server.js

The application will run on http://localhost:3000 (or your configured port)

Usage

Creating a Blog Post

  1. Register a new account or log in
  2. Navigate to "Create Post"
  3. Fill in the post title, content, and upload an image
  4. Click "Publish" to save your post

Searching Posts

  • Use the search functionality to find posts by keywords

User Management

  • Register for a new account
  • Log in with your credentials
  • Log out when finished

API Routes

  • GET / - Home page with all posts
  • GET /posts/:id - View individual post
  • GET /create - New post form
  • POST /posts - Store new post
  • GET /register - Registration form
  • POST /users - Store new user
  • GET /login - Login form
  • POST /login - Process login
  • GET /logout - Logout user
  • GET /search - Search posts
  • GET /about - About page
  • GET /contact - Contact page

Security Features

  • Password hashing with bcrypt
  • Session-based authentication
  • Input validation middleware
  • Protection against common web vulnerabilities

Future Enhancements

  • Post categories and tags
  • Comments section
  • User profiles with post history
  • Social sharing features
  • Email notifications
  • Admin panel
  • Database backups

Contributing

Contributions are welcome! Please feel free to submit pull requests or open issues for bugs and feature requests.

License

ISC

Author

Created by Burhan


Home Page: image Registration Page: image

About

A full-stack blog platform built with Node.js and Express, powered by MongoDB. Features user authentication with bcrypt password hashing, create and manage blog posts, search functionality, and file uploads. Includes authentication and validation middleware, responsive EJS templates, and session management for a complete blogging experience.

Resources

Stars

2 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages