This is a full-stack project that includes user authentication, user management, and password management functionalities. The backend is built with Node.js, Express, and MongoDB, while the frontend is built with React and Tailwind CSS.
Clone the repository
git clone <repository-url>
cd <repository-directory>/backend
Install dependencies
npm install
Set up environment variables
Create a .env
file in the backend
directory with the following variables:
MONGO_URI=<your-mongodb-uri>
JWT_SECRET=<your-jwt-secret>
Run the backend server
npm start
The backend server should now be running on http://localhost:5000
.
Navigate to the frontend directory
cd ../frontend
Install dependencies
npm install
Set up environment variables
Create a .env
file in the frontend
directory with the following variable:
REACT_APP_API_URL=http://localhost:5000
Run the frontend development server
npm start
The frontend development server should now be running on http://localhost:3000
.
backend/
│── server.js # Entry point of the backend application
│── config/db.js # MongoDB connection setup
│── middleware/
│ ├── jwtAuthMiddleware.js # JWT authentication middleware
│── models/
│ ├── User.js # User model schema
│── routes/
│ ├── auth.js # Authentication routes
│── controllers/
│ ├── authController.js # Authentication controller functions
frontend/
│── src/
│ ├── components/ # React components
│ │ ├── Home.jsx # Home page component
│ │ ├── Login.jsx # Login page component
│ │ ├── Register.jsx # Registration page component
│ │ ├── Dashboard.jsx # User dashboard component
│ │ ├── ProtectedRoute.jsx # Protected route component
│ ├── context/
│ │ ├── AuthContext.jsx # Authentication context provider
│ ├── services/
│ │ ├── api.js # Axios API service functions
│ ├── App.jsx # Main application component
│ ├── index.js # Entry point of the React application
/register
./login
./dashboard
.ProtectedRoute
component to ensure only authenticated users can access them.