A full-stack employee management application for storing, viewing, updating, and deleting employee records. The project uses a React frontend, a Flask REST API, and a MySQL database.
- View all employees in a dashboard/table interface
- Add new employees with validated email and phone input
- Update employee profile and contact information
- Delete employee records
- Store contact information in a separate related table
- MySQL-backed persistent storage
Frontend
- React
- TypeScript
- Vite
- Tailwind CSS
- ShadCN
Backend
- Python
- Flask
- Flask-CORS
- MySQL Connector/Python
- email-validator
- phonenumbers
Database
- MySQL
employee-management/
├── backend/
│ ├── app.py
│ ├── database.py
│ └── requirements.txt
└── frontend/
├── src/
├── package.json
└── vite.config.ts
The database is named:
employee_management
The current schema uses two tables:
employees
- id
- name
- department
- position
- salary
- joining_date
employee_contacts
- id
- employee_id
- email
- phone
employee_contacts.employee_id references employees.id, so each employee can have one related contact record. The API joins both tables internally and returns employee records in a simple format for the frontend.
Go to the backend folder:
cd backendCreate and activate a virtual environment:
python3 -m venv venv
source venv/bin/activateInstall dependencies:
pip install -r requirements.txtMake sure MySQL is running and that backend/database.py points to your local database credentials.
Run the Flask API:
python app.pyThe backend runs on:
http://localhost:5001
Go to the frontend folder:
cd frontendInstall dependencies:
npm installStart the development server:
npm run devThe frontend usually runs on:
http://localhost:5173
GET /Returns:
{
"message": "Employee Management API"
}GET /employeesReturns all employees with contact details joined from employee_contacts.
GET /employees/:idReturns one employee by ID.
POST /employeesExample body:
{
"name": "Sk Samim Naser",
"email": "samim.naser@example.com",
"phone": "9876543210",
"department": "Engineering",
"position": "Software Developer",
"salary": 95000,
"joining_date": "2026-07-17"
}PATCH /employees/:idExample body:
{
"department": "Finance",
"position": "Accounts Manager",
"salary": 68000
}DELETE /employees/:idDeletes the employee and their related contact record.
The backend validates:
nameandemailare required when creating an employeeemailmust be a valid email formatemailmust be uniquephonemust be a valid Indian phone number when provided