A progressive Node.js framework for building efficient and scalable server-side applications.
I have used "render" for hosting and when it is inactive then it can delay requests by 50 seconds or more. Kindly have patience till one request after that it becomes fast
- POST https://image-processing-system-vmeb.onrender.com/process-image/upload
- Here you will make file submission by uploading csv file which will have imageInputUrls that will start compressing after submission
curl --location 'https://image-processing-system-vmeb.onrender.com/process-image/upload' \
--form 'file=@"/path/to/file"'
-
Body: give Key as
file
and Attach csv file on Value -
On success you will recieve requestId which will be in the form of shown below. It will help to check processing status. You can check the status of Image whether it is compressed or still in pending status.
-
Response: { "message": "File uploaded successfully", "requestId": "80a03f07-e6e0-4a23-b356-c1d16c6a0434" }
-
GET https://image-processing-system-vmeb.onrender.com/process-image/status/:requestId
- Using the above endpoint you will be able to check processing status and see the compressed images in imageOutputUrls form
curl --location 'https://image-processing-system-vmeb.onrender.com/process-image/status/80a03f07-e6e0-4a23-b356-c1d16c6a0434' \
--data ''
-
Response: { "requestId": "80a03f07-e6e0-4a23-b356-c1d16c6a0434", "status": "Completed", "results": [ { "_id": "66d503f1d6e5e4f113a785b", "serialNumber": 1, "productName": "SKU1", "inputImageUrls": [ "https://placebear.com/g/200/200", "https://cdn.", "https://via.plaf" ], "outputImageUrls": [ "https://88.jpg", "https://89.jpg", "https://90.jpg" ], "status": "Completed", "requestId": "80a03f07-e6e0-4a23-b356-c1d16c6a0434", "__v": 1 }, { "_id": "66d503f1d6e5e4f0113a785d", "serialNumber": 2, "productName": "SKU2", "inputImageUrls": [ "https://www.png", "https://y.png" ], "outputImageUrls": [ "https://d0.jpg", "https://7.jpg" ], "status": "Completed", "requestId": "80a03f07-e6e0-4a23-b356-c1d16c6a0434", "__v": 1 } ] }
-
POST https://image-processing-system-vmeb.onrender.com/process-image/webhook
- This will give status in short
curl --location 'https://image-processing-system-vmeb.onrender.com/process-image/webhook' \
--header 'Content-Type: application/json' \
--data '{
"requestId": "80a03f07-e6e0-4a23-b356-c1d16c6a0434"
}'
-
Body: { "requestId": "80a03f07-e6e0-4a23-b356-c1d16c6a0434" }
-
Response: { "message": "Webhook processed successfully", "requestId": "80a03f07-e6e0-4a23-b356-c1d16c6a0434", "status": "Completed" }
-
GET https://image-processing-system-vmeb.onrender.com/process-image/
- This will just Get all entries
curl --location 'https://image-processing-system-vmeb.onrender.com/process-image/' \
--header 'Content-Type: application/json'
- Response: [{List out the uploads}]
- This can be disabled if needed
The project appears to be a Node.js application using NestJS that processes and compresses images and integrates with MongoDB and AWS S3.
- Image Processing:
- Fetch Images: Retrieves images from given URLs.
- Compress Images: Utilizes sharp for image compression and resizing. Implements a quality adjustment and resizing to reduce image size effectively.
- Image Upload: Compresses images further using imagemin and mozjpeg, and uploads the processed images to AWS S3.
- MongoDB: Stores image processing records and metadata using Mongoose. Connects to MongoDB using a URI from environment variables.
- Uses @nestjs/config to handle configuration and environment variables.
- Handles errors during image processing and uploading, including network errors and invalid URLs.
- Sends notifications via webhook upon processing completion, including information about failed URLs.
- CSV Processing: Parses and processes CSV files containing image URLs and other metadata.
- Database Operations: Provides CRUD operations for managing image processing records.
- NestJS: Framework for building the application.
- Sharp: For image manipulation and compression.
- AWS S3: For storing processed images.
- Mongoose: For MongoDB interaction.
- ConfigModule: For configuration management.
- CSV Upload: Users upload CSV files containing image URLs.
- Image Processing: Images are fetched from URLs, resized, and compressed.
- Storage: Processed images are uploaded to AWS S3.
- Record Update: Database records are updated with the status and URLs of processed images.
- Notification: A webhook is triggered to notify completion and report any failed URLs.
Nest framework TypeScript starter repository.
# clone the repository
$ npm install
# development
$ npm run start
# watch mode
$ npm run start:dev
# production mode
$ npm run start:prod
# unit tests
$ npm run test
# e2e tests
$ npm run test:e2e
# test coverage
$ npm run test:cov
Nest is an MIT-licensed open source project. It can grow thanks to the sponsors and support by the amazing backers. If you'd like to join them, please read more here.
Nest is MIT licensed.