This is a full-stack application built with React and Express that demonstrates user authentication.
- User registration
- User login
- Protected routes
- React
- Express
- MongoDB
- JWT for authentication
Make sure you have the following installed on your system:
- Node.js
- npm (Node Package Manager)
- yarn (optional, but recommended for frontend dependency management)
Clone the repository using the following command:
git clone https://github.com/shrey0511/Mern-Blog-Website-app.git
- Navigate to the backend directory:
cd Mern-Blog-Website/api
- Install backend dependencies:
npm install
- Create a
.env
file in the backend directory with the following content:
MONGO_URI=your_mongodb_connection_string
JWT_SECRET=your_jwt_secret
- Start the backend server:
nodemon index.js
- Navigate to the frontend directory:
cd ../client
- Install frontend dependencies:
yarn install
- Start the frontend development server:
yarn start
- Open your browser and go to
http://localhost:3000
.
- Register a new user.
- Login with the registered user credentials.
- Access protected routes after logging in.
Ensure you have the required dependencies by using the provided requirements.txt
files for both backend and frontend.
express
mongoose
dotenv
jsonwebtoken
nodemon
react
react-dom
react-router-dom
axios
To install all required dependencies for the backend and frontend, you can use the following commands:
cd Mern-Blog-Website/api
xargs -a requirements.txt -n 1 npm install
cd ../client
xargs -a requirements.txt -n 1 yarn add
This project is licensed under the MIT License. See the LICENSE file for details.
For any questions, suggestions, or feedback, feel free to contact the repository maintainer:
- Name: Shreyansh Singh
- Email: singh.shrey0511@gmail.com
- GitHub: https://github.com/shrey0511
Thank you for visiting this repository! We hope you find it useful and informative. Happy coding!