This project is a full-stack user authentication system built using React, Node.js, Express, and MongoDB as part of Task 1 for Prodigy Infotech Internship. It implements secure login, registration, session management, and protected routes.
- Frontend: React, Axios, React Router DOM
- Backend: Node.js, Express.js, MongoDB, bcrypt, express-session, connect-mongo
- π User Registration with hashed passwords using bcrypt
- π User Login with session-based authentication
- π‘οΈ Protected Routes with React Router
- π Session Handling with
express-sessionandconnect-mongo - π CORS configured for cross-origin requests
- β¨ Clean and user-friendly UI for Login & Register
- π Seamless navigation between Login
βοΈ RegisterβοΈ Dashboard
secure-authentication/ βββ client/ # React frontend β βββ components/ β β βββ Login.js β β βββ Register.js β βββ styles/ β β βββ Login.css β β βββ Register.css β βββ App.js β βββ index.js βββ server/ # Node.js backend β βββ server.js βββ .env βββ package.json βββ README.md
-
Clone the repository git clone https://github.com/your-username/secure-authentication.git cd secure-authentication
-
Install Backend Dependencies cd server npm install
-
Set up Environment Variables Create a .env file in the server folder: SESSION_SECRET=your_secret_key
4.Run Backend npm start
- Install Frontend Dependencies cd ../client npm install
6.Start React App npm start
Make sure your backend runs on http://localhost:3000 and frontend on http://localhost:3001.