Talent-Sphere is a frontend application designed for managing employee information within an organization. It allows users to add new employees and view a list of existing employees. The application provides a user-friendly interface for performing these tasks efficiently.
- Frontend:
- React: A JavaScript library for building user interfaces.
- Tailwind CSS: A utility-first CSS framework for styling.
- React Router: A library for routing in React applications.
- Backend:
- Node.js: A JavaScript runtime for building server-side applications.
- Express: A web application framework for Node.js.
- MongoDB: A NoSQL database for storing employee data.
- Mongoose: An ODM (Object Data Modeling) library for MongoDB and Node.js.
- dotenv: A module to load environment variables from a
.env
file. - cors: A middleware to enable Cross-Origin Resource Sharing.
- Node.js and npm installed on your machine.
- MongoDB installed and running on your machine.
-
Clone the Repository:
git clone https://github.com/cloudengine-labs/talent-sphere.git cd talent-sphere
-
Install Dependencies: Navigate to the frontend and backend directories and install the dependencies.
cd frontend npm install cd ../backend npm install
-
Set Up Environment Variables:
Create a .env
file in the backend directory and add the following environment variables:
MONGODB_URI=mongodb://localhost:27017/talent-sphere
PORT=5001
To start MongoDB, ensure you have MongoDB installed on your machine. You can start MongoDB using the following command:
mongod --dbpath ~/mongodb/data/db
If you encounter any issues with the data directory, create the directory and set the appropriate permissions:
mkdir -p ~/mongodb/data/db
sudo chown -R `id -un` ~/mongodb/data/db
-
Start the Backend Server: Navigate to the backend directory and start the server.
cd backend npm start
-
Start the Frontend Application:
Navigate to the frontend directory and start the React application.
cd frontend
npm start
The backend server provides the following API endpoints:
-
Add Employee:
- URL:
/api/employees/add
- Method:
POST
- Description: Adds a new employee to the database.
- Request Body:
{ "name": "John Doe", "empId": "E123", "doj": "2023-01-01", "dob": "1990-01-01", "projectDetails": "Project A", "mobile": "1234567890", "grossSalary": "50000" }
- URL:
-
View Employees:
- URL:
/api/employees/view
- Method:
GET
- Description: Retrieves a list of all employees from the database.
- URL:
- Navigate to the home screen of the Talent-Sphere application.
- Click on the "Add Employee" button.
- Fill in the employee details in the form.
- Click the "Submit" button to add the employee.
- Navigate to the home screen of the Talent-Sphere application.
- Click on the "View Employees" button.
- A list of all employees will be displayed. Verify the details of the newly added employee in the list.
By following these steps, you can successfully run the Talent-Sphere application, add new employees, and verify their details.
- Docker installed on your machine.
- Set Up Environment Variables:
Ensure you have the necessary environment variables set up in the .env
files for both the frontend and backend.
Create a .env
file in the frontend directory with the following content:
PORT=3000
REACT_APP_API_URL=http://localhost:5001
Create a .env
file in the backend directory with the following content:
MONGODB_URI=mongodb://localhost:27017/talent-sphere
PORT=5001
REACT_APP_API_URL=http://localhost:5001
- Build and Run Backend Docker Image:
Navigate to the backend directory and build the Docker image:
cd backend
docker build -t backend-image .
Run the Docker container:
docker run -p 5001:5001 backend-image
- Build and Run Frontend Docker Image:
Navigate to the frontend directory and build the Docker image:
cd frontend
docker build -t frontend-image .
Run the Docker container:
docker run -p 3000:3000 frontend-image
By following these steps, you can build and run Docker images for both the frontend and backend of the Talent-Sphere application, running on ports 3000 and 5001 respectively.
- Added sections to the README to explain how to build and run Docker images for the frontend and backend.
- Mentioned updating the
.env
files before running the images. - Provided detailed steps for building and running the Docker images.