This repository contains a Node.js application that processes large CSV files for bulk upload to a MongoDB database. The application leverages worker threads for parallel processing to efficiently handle large datasets. Progress updates are provided via socket.io to keep the user informed during the upload process.
- CSV Parsing: Efficiently parses large CSV files using streams.
- Batch Processing: Organizes data into batches for optimized database insertion.
- Parallel Processing: Uses worker threads to process batches in parallel.
- Progress Updates: Real-time progress updates via
socket.io. - Server Crash Recovery: Mechanism to resume uploads in case of server failure.
- Error Handling: Robust error handling and logging.
- Node.js
- MongoDB
-
Clone the repository
git clone https://github.com/Mrityunjay383/BulkUpload.git cd server -
Install dependencies
npm install
-
Set up environment variables Create a
.envfile in the root directory with the following contents:MONGO_URI=mongodb://localhost:27017/yourdbname PORT=5000 BATCH_SIZE=1000
-
Run the application
npm run dev
-
Access the application The application will be running on
http://localhost:5000.
-
Upload CSV File
Endpoint:
POST /upload- Description: Upload a CSV file for processing.
- Request: Form-data with a file field named
file. - Response: JSON with upload ID.
- Fork the repository
- Create a new branch
git checkout -b feature-name
- Commit your changes
git commit -m "Add some feature" - Push to the branch
git push origin feature-name
- Open a pull request
This project is licensed under the MIT License - see the LICENSE file for details.