This is a full-stack web application that allows users to upload files, compress them using Run-Length Encoding, and encrypt them with a password. It features a React frontend, a Node.js backend, and a C++ core for file processing.
.
├── backend
│ ├── cpp_backend # C++ executable
│ ├── db
│ │ └── users.json # File-based database for users
│ ├── index.js # Node.js server
│ ├── package.json
│ ├── processed # Directory for processed files
│ └── uploads # Directory for uploaded files
├── cpp
│ └── main.cpp # C++ source code
├── frontend
│ ├── public
│ ├── src
│ │ ├── components # React components
│ │ ├── pages # Page components
│ │ └── services # API services and AuthContext
│ └── package.json
└── README.md
- Frontend: React, React Router, Bootstrap, Axios
- Backend: Node.js, Express.js
- C++ Core: Standard C++ for file operations
- Database: JSON file (for simplicity)
- File Compression: Run-Length Encoding for lossless compression.
- File Encryption: Simple XOR-based encryption with a user-provided password.
- User Authentication: Signup and login functionality.
- Tiered System: Free and Premium user tiers with different file size limits.
- Ad Integration: Mock Google AdSense ads for free users.
- Payment Gateway: Mock Razorpay integration for upgrading to a premium plan.
The backend is a Node.js server using Express.js. It exposes a REST API to communicate with the frontend.
POST /api/auth/signup: Create a new user account.- Request Body:
{ "name": "Test User", "email": "test@example.com", "password": "password123" } - Response:
{ "message": "User created successfully" }
- Request Body:
POST /api/auth/login: Log in a user.- Request Body:
{ "email": "test@example.com", "password": "password123" } - Response:
{ "message": "Logged in successfully", "user": { ... } }
- Request Body:
POST /api/user/premium: Upgrade a user to premium.- Request Body:
{ "email": "test@example.com" } - Response:
{ "message": "User upgraded to premium", "user": { ... } }
- Request Body:
POST /api/upload: Upload a file for processing.- Request Body:
multipart/form-datawith fieldsfile,operation, andpassword(optional). - Response:
{ "message": "File processed successfully", "downloadPath": "..." }
- Request Body:
GET /api/download?path=<file_path>: Download a processed file.
The Node.js backend uses the child_process module to execute the compiled C++ program (cpp_backend). The C++ program handles the core file processing tasks (compression, encryption, etc.).
Command-line arguments for the C++ program:
./cpp_backend <operation> <input_file> <output_file> [password]
<operation>:compress,decompress,encrypt, ordecrypt<input_file>: Path to the input file.<output_file>: Path to the output file.[password]: Optional password for encryption/decryption.
- Razorpay: The pricing page includes a "Get started" button for the premium plan. When clicked, it simulates a Razorpay payment. On "successful payment," the frontend calls the
/api/user/premiumendpoint to upgrade the user's account. - Google AdSense: Placeholder ad components are displayed on the
UploadPageandDashboardPagefor users who are not premium.
-
Clone the repository:
git clone https://github.com/shinchan996/File-Converter cd file-compressor -
Install backend dependencies:
cd backend npm install cd ..
-
Install frontend dependencies:
cd frontend npm install cd ..
-
Compile the C++ code: You need a C++ compiler like
g++.g++ cpp/main.cpp -o backend/cpp_backend
-
Start the backend server:
cd backend node index.jsThe backend will be running at
http://localhost:3001. -
Start the frontend development server: In a new terminal:
cd frontend npm startThe frontend will be running at
http://localhost:3000.
- Backend: The Node.js backend can be deployed to platforms like Heroku, AWS Elastic Beanstalk, or a virtual private server (VPS).
- Frontend: The React frontend can be built into static files (
npm run build) and served by a static file server like Nginx, or hosted on platforms like Netlify or Vercel. - C++ Backend: When deploying, ensure the C++ code is compiled on the target server environment, or use a Docker container to package the entire application (Node.js backend + C++ executable).
-
- Name: shinachn996
- Email: dekusunita996@gmail.com
- GitHub: https://github.com/shinchan996
- Project: Online File Compressor and Converter
- Year: 2026