This project is a simple web application designed for managing a company's employees, departments, and projects. It includes both a backend built with Node.js and a frontend built with React.js. The database is managed using MySQL (phpMyAdmin). Handcrafted with love.
- CRUD Operations: Perform Create, Read, Update, and Delete operations on employees, departments, and projects.
- Login System: Secure login for users based on the database.
- Dynamic Search: Search records in the database by column and value.
- Modular Frontend: Built with React components for scalability.
Make sure you have the following installed on your system:
- Node.js (v14 or higher)
- npm (comes with Node.js)
- MySQL and phpMyAdmin
- Git (to clone the repository)
git clone https://github.com/itsHadyy/computerApps
cd bit_company
- Open phpMyAdmin in your browser.
- Create a new database named
bit_company
. - Import the
bit_company.sql
file from this repository:- Navigate to your database in phpMyAdmin.
- Click Import.
- Upload the
bit_company.sql
file from your cloned repository. - Click Go.
-
Navigate to the
backend
folder:cd backend
-
Install dependencies:
npm install express cors mysql2
-
Start the backend server:
node server.js
The backend server will run on http://localhost:5001.
-
Navigate to the
frontend
folder:cd ../frontend
-
Install dependencies:
npm install axios
-
Start the React development server:
npm start
The frontend will run on http://localhost:3000.
- Open your browser and navigate to http://localhost:3000.
- Use the login system to access the application.
- Perform CRUD operations, search, and view data dynamically.
bit_company/
├── backend/
│ ├── server.js # Backend server
│ ├── package.json # Backend dependencies
│ ├── package-lock.json # Lock file
├── frontend/
│ ├── src/
│ │ ├── components/ # React components
│ │ │ ├── Dashboard.js
│ │ │ ├── DeleteRecord.js
│ │ │ ├── InsertData.js
│ │ │ ├── Login.js
│ │ │ ├── Navbar.js
│ │ │ ├── SearchData.js
│ │ │ ├── TableView.js
│ │ │ ├── UpdateData.js
│ │ ├── App.js # Main React app file
│ │ ├── App.css # CSS for the app
│ ├── public/
│ │ ├── index.html # HTML entry point
├── README.md # This file
├── bit_company.sql # Database file
- Make sure your MySQL server is running and your phpMyAdmin is accessible before importing the database.
- The database connection in the backend assumes
root
as the username with no password. Update these credentials inserver.js
if your setup is different. - Start the backend server first, then the frontend.
- Error: Connection refused: Ensure MySQL is running, and the database is imported properly.
- Modules not found: Run
npm install
in bothbackend
andfrontend
directories.
- Allows users to insert new records into the database.
- Includes a dynamic form to handle various table fields.
- Provides functionality to update existing records.
- Fetches the selected row's data and pre-fills the form.
- Includes a "Cancel" button to close the form without saving changes.
- Handles record deletion by calling the backend API.
- Provides a confirmation prompt before deletion.
- Implements a search functionality for querying records.
- Supports dynamic search based on user inputs.
- Displays database records in a table format.
- Integrates with
UpdateData
andDeleteRecord
for record management.
- Handles user authentication.
- Sends credentials to the backend for validation.
- A reusable navigation bar component for the application.
The backend exposes the following RESTful API endpoints:
-
Insert Record
POST /<table>
: Inserts a new record into the specified table.
-
Update Record
PUT /<table>/<id>
: Updates a record with the given ID.
-
Delete Record
DELETE /<table>/<id>
: Deletes a record with the given ID.
-
Search Records
GET /<table>?query=<value>
: Searches for records based on a query.
-
Login
POST /login
: Authenticates user credentials.
- Update the API endpoints in the React components to match your backend routes.
- Modify CSS files (
App.css
andindex.css
) to style the application according to your needs. - Add more components or functionality as per your project requirements.
-
CORS Error
- Ensure CORS is enabled on your backend server.
-
API Endpoint Not Found
- Verify that the backend server is running and the endpoints are correct.
-
MySQL Connection Error
- Check your MySQL connection details in
server.js
.
- Check your MySQL connection details in
- Understand Each Component: Take time to understand how each React component interacts with the backend.
- Experiment: Try modifying the code to add additional features.
- Debugging: Use
console.log
to debug issues during development. - Follow Best Practices: Write clean, modular code and follow proper naming conventions.
Feel free to contribute to this project by:
- Reporting bugs
- Suggesting new features
- Submitting pull requests
This project is licensed under the MIT License. """