This is a full-stack authentication application built using the MERN (MongoDB, Express.js, React.js, Node.js) stack. The application allows users to register, login, and authenticate using JWT (JSON Web Tokens).
- User registration with validation
- User login with authentication
- JWT token-based authentication
- Password hashing for security
- MongoDB database storage
-
client/: Frontend React application
- public/: Public assets and HTML template
index.html
: HTML template
- src/: Source code directory
- components/: React components
Login.js
: Component for user loginRegister.js
: Component for user registrationHome.js
: Component for the home pageApp.js
: Main application componentApp.css
: Styles for the main application componentindex.js
: Entry point for React applicationindex.css
: Global styles- ... Other components
- components/: React components
- public/: Public assets and HTML template
-
api/: Backend Node.js and Express server
- models/: MongoDB models
User.js
: Model for user data
server.js
: Express server setuppackage.json
: Project dependencies and scripts
- models/: MongoDB models
- cd client
- npm install
- cd server
- npm install
-From the root directory:
Client:
- cd client
- npm start
- This will start the React frontend on http://localhost:3000.
Api:
- cd api
- npm start
- This will start the Node.js backend on http://localhost:4000.
- Register: Users can register by providing their email and password.
- Login: Registered users can log in using their credentials.
- Authentication: Authenticated routes are protected and require a valid JWT token.
- MongoDB is used as the database for storing user information, including credentials and other relevant data.
- Express.js is utilized to create the backend server for handling HTTP requests, defining routes, and interacting with the MongoDB database.
- React.js is employed to develop the frontend user interface of the authentication application. It enables the creation of reusable UI components and manages the application's state efficiently.
- Node.js serves as the server-side JavaScript runtime environment. It executes the backend logic, including user authentication, token generation, and database interactions.
These technologies work together seamlessly in the MERN stack to create a robust, scalable, and efficient authentication application.