This project is a full-stack authentication system built with React for the frontend and Node.js with Express for the backend. It includes user registration, login, and protected routes to demonstrate authentication and authorization concepts.
- User Registration: Users can create an account by providing a username, email, and password.
- User Login: Registered users can log in using their credentials.
- JWT Authentication: Secure authentication using JSON Web Tokens (JWT).
- Protected Routes: Certain routes are accessible only to authenticated users.
- User Sessions: Maintain user sessions with token-based authentication.
- Password Encryption: User passwords are securely stored using bcrypt.
- Frontend: React, React Router
- Backend: Node.js, Express, MongoDB (with Mongoose for ORM)
- Authentication: JSON Web Tokens (JWT), Joi
- Environment: Node.js, npm, dotenv
- Node.js (v14 or higher)
- npm (v6 or higher)
- MongoDB
-
Clone the repository:
git clone [https://github.com/atishaytripathi/authentication.git](https://github.com/atishaytripathi/authentication.git) cd authentication -
Install backend dependencies:
cd backend npm install -
Install frontend dependencies:
cd ../frontend npm install
-
Start the backend server:
cd backend npm startThe backend server will run on
http://localhost:5000. -
Start the frontend development server:
cd ../frontend npm startThe frontend development server will run on
http://localhost:3000.
- POST /api/signup: Register a new user
- POST /api/signin: Login a user
Contributions are welcome! Please open an issue or submit a pull request for any changes.
For any questions or issues, please contact atishay1922@gmail.com.
Feel free to use and modify this template according to your project's specific needs. Happy coding!