This MERN (MongoDB, Express, React, Node.js) blog platform allows users to register, log in, create posts, and manage their content. Here are the key features:
User Authentication: Secure sign-up and login with JSON Web Tokens (JWT). Users receive a unique token upon login for authentication in further interactions. Create and View Posts: Users can create posts that are displayed on the homepage. Each post shows the time it was created and the user who posted it. Edit and Delete Posts: Users can edit or delete their own posts, providing flexibility and control over their content. Profile Management: Users can update their profile information, such as name and password. This project demonstrates full CRUD (Create, Read, Update, Delete) operations, emphasizing the capabilities of the MERN stack.
The following packages were used to build the platform:
Express: A robust web framework for Node.js. Mongoose: An ODM (Object Data Modeling) library for MongoDB. jsonwebtoken: Generates and verifies JSON Web Tokens for secure user authentication. bcrypt: Used to hash and salt user passwords for security. dotenv: Allows you to manage environment variables for secure configuration of sensitive information, like PORT and MONGO_URL. cors: Handles Cross-Origin Resource Sharing, enabling secure API requests from different domains. morgan: A logging tool for HTTP requests in Node.js applications. colors: Adds color to console output, improving readability.
A more detailed look at the platform's core functionalities:
User Registration and Login: Users can register with an email and password, and log in to receive a unique JWT. Create and View Posts: Users can create new posts, which appear on the homepage. Each post indicates when and by whom it was created. Edit and Delete Posts: Users can edit or delete their own posts, giving them control over their content. Profile Management: Users can update their profile information, ensuring their details are always up to date.
The project follows a typical MERN stack structure, with the following key components:
Backend: Built with Express and Mongoose, handling routes, controllers, and database interactions. Database: MongoDB serves as the backend database, storing user information, posts, and related data.
To use the platform, follow these steps:
Sign Up or Log In: Use the registration or login feature to create an account or access an existing one. Create a Post: Use the provided form to create a new post. Posts will be displayed on the homepage. Edit or Delete Your Posts: If you need to make changes, you can edit or delete your own posts. Update Your Profile: Keep your profile information current by updating your name or password as needed.