PixelForge is a web-based tool designed to simplify image conversion and manipulation. With support for various file formats, it enables users to upload, convert, and customize images with ease. The tool handles complex operations such as format conversion, resizing, rotation, flipping, and more, all while maintaining high performance using asynchronous processing and Redis-based worker queues for scalability.
- Drag and Drop Image Upload: Simplify file selection with a drag-and-drop interface.
- Multiple Image Format Support: Convert images to/from popular formats like JPG, PNG, TIFF, WebP, GIF, and more.
- Image Manipulation: Rotate, flip, and resize images before converting.
- Rate-Limiting: Limit usage per user with token-based API access for registered users and daily limits for guests.
- Scalable: Utilizes Redis-based worker queues for asynchronous processing, making it highly scalable under heavy traffic.
- Real-Time Feedback: Display conversion progress and downloadable files with an intuitive UI.
Follow these steps to set up the project locally.
- Node.js (version 14.x or later)
- Redis (for the worker queue)
- MongoDB (optional, depending on user authentication system)
-
Clone the repository:
git clone https://github.com/theritikchoure/pixelforge.git cd pixelforge -
Install dependencies for both the server and client:
-
Navigate to the
serverdirectory and install the backend dependencies:cd server npm install -
Navigate to the
clientdirectory and install the frontend dependencies:cd ../client npm install
-
-
Set up the environment variables in
serverdirectory by creating a.envfile:touch .env
Populate it with the following details:
PORT=3001 MONGO_URI=mongodb://localhost:27017/pixelforge REDIS_URL=redis://localhost:6379 JWT_SECRET=your_jwt_secret DAILY_LIMIT=5 REGISTERED_USER_LIMIT=500 -
Start the Redis server locally (if not already running):
redis-server
-
Start the backend server:
cd server npm startThe app will be running on
http://localhost:3001. -
Start the frontend server:
cd client npm startThe app will be running on
http://localhost:3000.
-
POST
/convertConverts an uploaded image based on user-selected options (format, rotation, etc.).
-
Request Body:
file: The image to be uploaded (multipart form data).conversionType: The target format (e.g.,png,jpg,webp).rotate: Rotation angle (optional).flip: Whether to flip the image horizontally (optional).
-
Response: Converted image file in the selected format.
-
curl -X POST http://localhost:3001/convert \
-F 'file=@path/to/your/image.png' \
-F 'conversionType=jpg' \
-F 'rotate=90' \
-F 'flip=true'-
Frontend:
- Next.js
- Tailwind CSS
-
Backend:
- Node.js
- Express.js
- Sharp (for image manipulation)
- Multer (for file uploads)
- Redis + Bull (for queue management)
- MongoDB (for user authentication and tracking)
-
Other:
- Axios (for HTTP requests)
-
Guests: Can process up to 5 images per day.
-
Registered Users: Can process up to 500 images per day. Requires API token.
Example API Request with Token:
curl -X POST http://localhost:3001/convert \ -H "Authorization: Bearer your_token_here" \ -F 'file=@path/to/your/image.png' \ -F 'conversionType=jpg'
PixelForge is designed to handle a large volume of requests using Redis-based queues. Here’s how the queue system works:
-
Worker Queue: The backend offloads image processing tasks to a Redis-based Bull queue. Each image conversion task is processed asynchronously by worker nodes.
-
Horizontal Scaling: The worker nodes can be scaled horizontally to handle increased load.
We welcome contributions from the community!
- Fork the repository.
- Create a feature branch.
- Commit your changes.
- Open a pull request.
Make sure to follow our contributing guidelines for more details.
This project is licensed under the MIT License - see the LICENSE file for details.