A modern, full-stack file conversion web application built with Next.js, Express.js, and Prisma. Convert documents, images, audio, and video files with real-time progress tracking and a beautiful user interface.
- π Document Conversion: PDF β DOCX β TXT
- πΌοΈ Image Conversion: JPG β PNG β GIF
- π΅ Audio Conversion: MP3 β WAV
- π¬ Video Conversion: MP4 β AVI
- π― Drag & Drop Interface: Modern, intuitive file upload
- π Real-time Progress: Live conversion progress with status updates
- π± Responsive Design: Works on desktop, tablet, and mobile
- ποΈ Conversion History: Track all your conversions
- β‘ Fast Processing: Efficient background worker processing
- π Secure: File validation and error handling
- π Dark Mode: Beautiful UI with dark/light theme support
- Frontend: Next.js 14 with React 18, TailwindCSS, React Dropzone
- Backend: Express.js with Prisma ORM, SQLite database
- Worker: Background processing with LibreOffice, FFmpeg, ImageMagick
- Storage: Local filesystem (with S3 support)
- Queue: In-memory for development, BullMQ + Redis for production
Before running this project, ensure you have:
- Node.js 18+ - Download here
- npm or yarn - Comes with Node.js
For file conversions to work, install these tools:
# Install via Chocolatey (recommended)
choco install ffmpeg imagemagick libreoffice
# Or install manually:
# - FFmpeg: https://ffmpeg.org/download.html
# - ImageMagick: https://imagemagick.org/script/download.php#windows
# - LibreOffice: https://www.libreoffice.org/download/
# Install via Homebrew
brew install ffmpeg imagemagick libreoffice
sudo apt update
sudo apt install ffmpeg imagemagick libreoffice
Windows:
# Run the setup script
scripts\setup-dev.bat
# Start development servers
scripts\start-dev.bat
Linux/macOS:
# Make scripts executable
chmod +x scripts/*.sh
# Run the setup script
./scripts/setup-dev.sh
# Start development servers
./scripts/start-dev.sh
- Clone and Install Dependencies
git clone <repository-url>
cd Converter
# Install backend dependencies
cd backend
npm install
cd ..
# Install frontend dependencies
cd frontend
npm install
cd ..
# Install worker dependencies
cd worker
npm install
cd ..
- Set up Environment Variables
# Copy environment file
cp .env.example .env
# Edit .env file with your configuration
- Initialize Database
# Generate Prisma client
npx prisma generate
# Create database
npx prisma db push
- Create Upload Directory
mkdir uploads
- Start Development Servers
In separate terminal windows:
# Terminal 1: Start backend
cd backend
npm run dev
# Terminal 2: Start frontend
cd frontend
npm run dev
- Open Your Browser Navigate to http://localhost:3000
The .env
file contains all configuration options:
# Backend Configuration
PORT=4000
FRONTEND_URL=http://localhost:3000
BACKEND_URL=http://localhost:4000
# Storage Configuration
STORAGE_MODE=local # "local" or "s3"
STORAGE_LOCAL_PATH=uploads
MAX_FILE_SIZE_BYTES=104857600 # 100MB
# Database
DATABASE_URL=file:./dev.db
# Conversion Tools (adjust paths as needed)
FFMPEG_PATH=ffmpeg
IMAGEMAGICK_CONVERT=magick
LIBREOFFICE_PATH=soffice
# Redis (for production)
REDIS_HOST=
REDIS_PORT=6379
# JWT Security
JWT_SECRET=your-super-secret-key-here
JWT_EXPIRES_IN=7d
# S3 Configuration (if using S3)
S3_BUCKET=your-bucket-name
S3_ACCESS_KEY=your-access-key
S3_SECRET_KEY=your-secret-key
S3_REGION=us-east-1
S3_ENDPOINT=https://s3.amazonaws.com
Category | Input Formats | Output Formats |
---|---|---|
Documents | PDF, DOCX, DOC, TXT | PDF, DOCX, TXT |
Images | JPG, PNG, GIF | JPG, PNG, GIF |
Audio | MP3, WAV | MP3, WAV |
Video | MP4, AVI | MP4, AVI |
File Size Limit: 100MB per file
- Upload: User drags/drops or selects a file
- Validation: Frontend validates file type and size
- API Call: File is uploaded to backend via REST API
- Database: Conversion job is stored in SQLite database
- Queue: Job is added to processing queue
- Worker: Background worker processes the conversion
- Progress: Real-time progress updates via polling
- Download: Converted file is available for download
Converter/
βββ backend/
β βββ src/
β β βββ routes/ # API routes
β β β βββ auth.js # Authentication
β β β βββ convert.js # Conversion API
β β βββ services/ # Business logic
β β β βββ queue.js # Job queue management
β β β βββ storage.js # File storage
β β βββ middleware/ # Express middleware
β β β βββ validation.js
β β βββ server.js # Express server
β βββ package.json
βββ frontend/
β βββ pages/ # Next.js pages
β β βββ _app.js # App wrapper
β β βββ index.js # Main page
β βββ components/ # React components
β β βββ ConversionHistory.js
β β βββ ErrorBoundary.js
β βββ utils/ # Utility functions
β β βββ fileValidation.js
β βββ styles/ # CSS styles
β β βββ globals.css
β βββ package.json
βββ worker/
β βββ src/
β β βββ worker.js # Main worker process
β β βββ documentConverter.js
β βββ package.json
βββ prisma/
β βββ schema.prisma # Database schema
βββ scripts/ # Development scripts
β βββ setup-dev.bat # Windows setup
β βββ setup-dev.sh # Linux/macOS setup
β βββ start-dev.bat # Windows start
β βββ start-dev.sh # Linux/macOS start
βββ .env # Environment variables
βββ README.md
POST /api/convert/upload
- Upload file for conversionGET /api/convert/status/:id
- Get conversion statusGET /api/convert/download/:id
- Download converted filePUT /api/convert/status/:id
- Update conversion status (worker)GET /api/convert/list
- List conversion history
GET /health
- Server health status
- Start the development servers
- Open http://localhost:3000
- Try uploading different file types:
- PDF β DOCX conversion
- JPG β PNG conversion
- MP3 β WAV conversion
- TXT β PDF conversion
Use tools like Postman or curl:
# Health check
curl http://localhost:4000/health
# Upload file
curl -X POST -F "file=@test.pdf" -F "format=docx" \
http://localhost:4000/api/convert/upload
# Check status
curl http://localhost:4000/api/convert/status/[job-id]
# Build frontend
cd frontend
npm run build
cd ..
# Or use the build script
./scripts/build-prod.sh
- Set up Redis for production queue
- Configure S3 for file storage
- Set up proper JWT secrets
- Configure HTTPS
Use PM2 for production process management:
npm install -g pm2
# Start backend
cd backend
pm2 start src/server.js --name "converter-backend"
# Start frontend (if using PM2)
cd frontend
pm2 start npm --name "converter-frontend" -- start
# Start worker (if using separate worker)
cd worker
pm2 start src/worker.js --name "converter-worker"
Example Nginx config:
server {
listen 80;
server_name yourdomain.com;
# Frontend
location / {
proxy_pass http://localhost:3000;
proxy_http_version 1.1;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection 'upgrade';
proxy_set_header Host $host;
proxy_cache_bypass $http_upgrade;
}
# Backend API
location /api/ {
proxy_pass http://localhost:4000;
proxy_http_version 1.1;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header Host $host;
}
# File downloads
location /files/ {
proxy_pass http://localhost:4000;
}
}
1. Conversion tools not found
Error: Command failed: ffmpeg
Solution: Install FFmpeg, ImageMagick, and LibreOffice. Update paths in .env
.
2. File upload fails
Error: File too large
Solution: Check MAX_FILE_SIZE_BYTES
in .env
and server limits.
3. Database connection error
Error: Can't reach database server
Solution: Run npx prisma db push
to create the database.
4. Permission denied on Linux/macOS
permission denied: ./scripts/setup-dev.sh
Solution: Run chmod +x scripts/*.sh
to make scripts executable.
5. Port already in use
Error: listen EADDRINUSE :::4000
Solution: Change ports in .env
or kill existing processes.
Enable debug logging:
# Add to .env
NODE_ENV=development
DEBUG=converter:*
Check logs in:
- Backend: Console output
- Frontend: Browser console
- Worker: Process logs
- Fork the repository
- Create a feature branch:
git checkout -b feature-name
- Make changes and test thoroughly
- Commit:
git commit -m 'Add feature'
- Push:
git push origin feature-name
- Submit a pull request
This project is licensed under the MIT License - see the LICENSE file for details.
If you encounter any issues:
- Check this README and troubleshooting section
- Search existing issues on GitHub
- Create a new issue with:
- Your operating system
- Node.js version
- Complete error message
- Steps to reproduce
- Batch file conversion
- User authentication and file management
- Advanced conversion options
- API rate limiting
- File compression
- Cloud storage integration
- Email notifications
- Conversion templates
Happy Converting! π