WeldPak is a powerful Next.js application that allows you to combine and minify JavaScript and CSS files with ease. Built with modern technologies including React Bootstrap, Redux Toolkit, Formik, and Firebase Functions for scalable deployment.
- Multi-file Upload: Upload multiple JavaScript or CSS files simultaneously
- File Reordering: Drag and drop to reorder files before processing
- Smart Minification:
- JavaScript minification using Terser with advanced optimizations
- CSS minification using CleanCSS
- Compression Statistics: View original vs minified file sizes and compression ratios
- Download Options: Download combined or minified versions
- Processing History: Track and manage previously processed files
- Responsive Design: Modern UI built with React Bootstrap
- State Management: Redux Toolkit with async thunks for robust state handling
- Form Validation: Formik with Yup validation schemas
- Scheduled Tasks: Firebase Functions with Cloud Scheduler for automated cleanup
- Docker Support: Full containerization for easy deployment
- Firebase Integration: Ready for Firebase hosting and functions
- Next.js 15 - React framework with App Router
- React Bootstrap - UI components and styling
- Redux Toolkit - State management with async thunks
- Formik - Form handling and validation
- Yup - Schema validation
- TypeScript - Type safety
- Next.js API Routes - REST API endpoints
- Firebase Functions - Serverless functions for processing
- Terser - JavaScript minification
- CleanCSS - CSS minification
- Cloud Scheduler - Automated task scheduling
- Docker - Containerization
- Firebase Hosting - Static site hosting
- Firebase Firestore - Database for processing history
- Firebase Storage - File storage (future use)
- Node.js 18+
- npm or yarn
- Docker (optional)
- Firebase CLI (for deployment)
-
Clone the repository
git clone <repository-url> cd weldpak
-
Install dependencies
npm install
-
Install Firebase Functions dependencies
npm run functions:install
-
Set up environment variables
cp env.example .env.local # Edit .env.local with your Firebase configuration -
Run the development server
# Local development (uses Next.js API routes) npm run devOpen http://localhost:3000 to view the application.
-
Build and run with Docker Compose
npm run docker:dev
-
Run with production profile (includes Nginx)
npm run docker:prod
-
Initialize Firebase
npm run firebase:init
-
Update
.firebasercwith your project ID{ "projects": { "default": "your-firebase-project-id" } } -
Deploy to Firebase
# Deploy with Next.js API routes (default) npm run firebase:deploy # OR deploy with Firebase Functions backend npm run firebase:deploy:functions
- Select the JavaScript or CSS tab
- Click the upload area or drag and drop files
- Reorder files by dragging them (optional)
- Click "Combine & Minify" to process the files
- Download the combined or minified results
- JavaScript: Uses Terser with console.log removal, debugger removal, and variable mangling
- CSS: Uses CleanCSS level 2 optimization for maximum compression
- Order: Files are processed in the order they appear in the list
- View all previously processed files
- See compression statistics
- Download results again
- View detailed processing information
- POST: Process uploaded files for combining and minification
- GET: Health check endpoint
- GET: Application health status
- HTTP function for file processing
- Handles CORS and file validation
- Returns processed results
- Runs daily at 2 AM UTC
- Cleans up old processing tasks (30+ days)
- Maintains database hygiene
- Callable functions for task management
- Store and retrieve processing status
weldpak/
├── src/
│ ├── app/ # Next.js App Router
│ │ ├── api/ # API routes
│ │ ├── globals.css # Global styles
│ │ ├── layout.tsx # Root layout
│ │ └── page.tsx # Home page
│ ├── components/ # React components
│ │ ├── WeldPakApp.tsx # Main application
│ │ ├── FileUploadPanel.tsx
│ │ └── ProcessedFilesList.tsx
│ └── store/ # Redux store
│ ├── index.ts # Store configuration
│ ├── hooks.ts # Typed hooks
│ └── slices/
│ └── fileSlice.ts # File state management
├── functions/ # Firebase Functions
│ ├── src/
│ │ └── index.ts # Function definitions
│ ├── package.json
│ └── tsconfig.json
├── docker-compose.yml # Docker Compose configuration
├── Dockerfile # Docker image definition
├── firebase.json # Firebase configuration
└── nginx.conf # Nginx configuration
WeldPak uses a hybrid backend approach:
- Local Development: Uses Next.js API routes (
/api/*) - Production: Uses Firebase Functions
The backend is automatically selected based on the NEXT_PUBLIC_USE_FIREBASE_FUNCTIONS environment variable.
-
Install Firebase CLI
npm install -g firebase-tools
-
Login to Firebase
firebase login
-
Upgrade to Blaze Plan (Required for Firebase Functions)
- Visit: https://console.firebase.google.com/project/weldpak/usage/details
- Upgrade to Blaze (pay-as-you-go) plan
-
Deploy to Firebase
# Deploy hosting only (static version) npm run firebase:deploy # Deploy functions only npm run firebase:deploy:functions # Deploy everything (hosting + functions) npm run firebase:deploy:all
npm run docker:build
npm run docker:runnpm run build
npm startCreate a .env.local file with the following variables:
FIREBASE_PROJECT_ID=your-firebase-project-id
FIREBASE_API_KEY=your-firebase-api-key
FIREBASE_AUTH_DOMAIN=your-project.firebaseapp.com
FIREBASE_STORAGE_BUCKET=your-project.appspot.com
FIREBASE_MESSAGING_SENDER_ID=your-sender-id
FIREBASE_APP_ID=your-app-id
# API Configuration
USE_FIREBASE_FUNCTIONS=false
FIREBASE_FUNCTIONS_URL=https://your-region-your-project.cloudfunctions.netWeldPak supports two backend architectures:
- Local Development: Fast, simple, no external dependencies
- Deployment: Works with any Next.js hosting (Vercel, Netlify, etc.)
- Configuration:
USE_FIREBASE_FUNCTIONS=false
- Production: Auto-scaling, global distribution, scheduled tasks
- Deployment: Firebase hosting with serverless functions
- Configuration:
USE_FIREBASE_FUNCTIONS=true
The app automatically detects the backend based on environment variables:
# Development with Next.js API
npm run dev
# Development with Firebase Functions
npm run dev:firebase
# Production with Next.js API
npm run firebase:deploy
# Production with Firebase Functions
npm run firebase:deploy:functions- Fork the repository
- Create a feature branch
- Make your changes
- Add tests if applicable
- Submit a pull request
This project is licensed under the MIT License.
For support and questions, please open an issue on GitHub.