This is a full-stack application for managing users with a front-end built using HTML, CSS, and JavaScript, and a back-end powered by Node.js, Express, and MySQL.
- Add new users with a name, email, and role (User/Admin).
- View a list of all users.
- Edit user details.
- Delete users.
- Responsive and user-friendly UI.
- Smooth animations and minimalistic design.
Before setting up this project, ensure you have the following installed on your machine:
First, you need to set up a MySQL server on your local machine.
-
Update the package index:
sudo apt update
-
Install the MySQL server:
sudo apt install mysql-server
-
Log in to the MySQL shell as root:
sudo mysql -u root
-
Set a password for the root user and update the authentication method:
ALTER USER 'root'@'localhost' IDENTIFIED WITH mysql_native_password BY 'password'; FLUSH PRIVILEGES;
Replace
'password'with a secure password of your choice. -
Exit the MySQL shell:
exit;
-
Log in to the MySQL shell again with the new password:
sudo mysql -u root -p
Enter the password you set in the previous step.
-
Create a new database:
CREATE DATABASE test_db;
-
Switch to the new database:
USE test_db;
-
Create the
userstable:CREATE TABLE users ( id INT AUTO_INCREMENT PRIMARY KEY, name VARCHAR(255) NOT NULL, email VARCHAR(255) NOT NULL UNIQUE, role ENUM('Admin', 'User') NOT NULL );
This table will store user information, including their name, email, and role.
The client side of the application is built using modern JavaScript, HTML, and CSS. To configure and run the client:
-
Navigate to the client folder:
cd client -
Install the required dependencies:
npm install
-
Build the client application:
npm run build
This will create a production build of the client application, which will be served by the Express server.
The server side is built using Node.js and Express and connects to the MySQL database to manage user data.
-
Navigate to the server folder:
cd server -
Install the required dependencies:
npm install
-
Start the server:
npm start
The server will run on
http://localhost:5000by default.
After following the setup instructions, you can access the application by navigating to http://localhost:5000 in your web browser.
- Add User: Fill in the name, email, and role in the form and click "Add User" to add a new user.
- View Users: The user list will be displayed below the form. Each user entry will have "Edit" and "Delete" buttons.
- Edit User: Click the "Edit" button next to a user entry to update their details.
- Delete User: Click the "Delete" button next to a user entry to remove them from the list.
This project is licensed under the MIT License - see the LICENSE file for details.