This project is a MERN (MongoDB, Express.js, React, Node.js) stack blogging website that allows users to create and view blog posts. User authentication is implemented using sessions. While the current version supports creating and viewing posts, update and delete functionalities are planned for future development.
- User Authentication: Secure user authentication via sessions.
- Create Blog Posts: Users can write and publish blog posts.
- View Blog Posts: Users can read all published blog posts.
- Image Uploads: Blog cover images are uploaded using Multer and stored on Cloudinary.
- Node.js and npm: Ensure Node.js and npm are installed. You can download them from nodejs.org. Recommend using a version manager like
nvm(Node Version Manager) for easier switching between Node.js versions. - MongoDB: A running instance of MongoDB is required. This can be a local installation or a cloud-based service like MongoDB Atlas. Obtain connection details (URI) for the setup process.
- Cloudinary Account: A Cloudinary account is needed for image storage. Sign up for a free account at cloudinary.com and obtain your Cloudinary cloud name, API key, and API secret.
-
Clone the repository:
git clone <repository_url> cd <project_directory>
-
Install dependencies:
npm install
-
Environment Variables:
Create a
.envfile in the root directory of the project and add the following environment variables, replacing the placeholders with your actual values:MONGODB_URI=<your_mongodb_connection_string> CLOUDINARY_CLOUD_NAME=<your_cloudinary_cloud_name> CLOUDINARY_API_KEY=<your_cloudinary_api_key> CLOUDINARY_API_SECRET=<your_cloudinary_api_secret> SESSION_SECRET=<your_session_secret> // Choose a strong secret key PORT=<your_port> // Optional: specify the port (default is usually 5000) -
Start the development server:
npm start
This will start both the frontend (React) and backend (Node.js) servers. The specific commands for starting each server should be defined in the
package.jsonfile. If separate commands are required, they should be documented here.
Currently, no scripts are defined in the package.json. Add scripts for common tasks like starting the development server, building the project, running tests, etc. For example:
"scripts": {
"start": "node server.js",
"build": "react-scripts build",
"test": "jest",
"dev": "concurrently \"npm run server\" \"npm run client\"",
"server": "nodemon server.js",
"client": "npm start --prefix client"
},These scripts would then be runnable via npm run <script_name>. Ensure the commands within the scripts are accurate and reflect the project structure.
Detailed information about the project structure, coding style, and contribution guidelines should be added here. This section should guide other developers on how to contribute to the project effectively.
Deployment instructions will depend on the chosen platform (e.g., Heroku, AWS, Netlify). This section should provide clear steps on how to deploy the application to a production environment. Include any specific configuration needed for deployment.
- Update and Delete Blog Posts: Implement functionality for users to edit and delete their own blog posts.
- Enhanced User Interface: Improve the overall user experience with a more polished and intuitive design.
- Search Functionality: Add a search bar to allow users to easily find specific blog posts.
- Comment System: Allow users to comment on blog posts and engage in discussions.
- Testing: Implement a comprehensive testing suite (unit and integration tests) to ensure code quality and prevent regressions.
This enhanced README provides a more comprehensive overview of the project, including clear setup instructions, environment variable documentation, and guidance for future development. Remember to keep this README up-to-date as the project evolves.