SecureShield is a production-ready MERN stack (MongoDB, Express, React, Node.js) boilerplate specifically engineered to provide a rock-solid foundation for applications that require highly secure file uploading and processing.
It goes beyond basic validation by implementing a custom Security Engine that actively analyzes uploaded files for malicious intent, making it the perfect starting point for document management systems, image hosting platforms, or any SaaS that accepts user files.
- React Client: Premium glassmorphism UI built with Vite, React Router, and Zustand state management.
- Node/Express API: Robust backend architecture with custom error handling, Winston logging, and JWT authentication (via Passport.js).
- MongoDB: Mongoose models for Users and FileRecords.
- RBAC: Role-Based Access Control distinguishing between standard
userandadminroles.
SecureShield implements a multi-layered defense system:
- Size Limits & Rate Limiting: Enforces strict payload limits (5MB) via Multer and rate limits file upload endpoints (100 per 15 min) to prevent DoS attacks.
- MIME Spoofing Detection: Uses
file-typeto read the exact binary "magic bytes" of a file. If an attacker uploads avirus.exerenamed toimage.png, the engine detects the discrepancy and rejects it. - Deep Archive Inspection: Securely parses
.zipheaders without extracting them (usingadm-zip) to look for hidden executables (.exe,.sh,.bat) inside. - Zip Bomb Protection: Calculates the internal uncompressed size and file count of archives. If an archive expands by 100x its size or contains over 10,000 files, it is instantly rejected to protect your server's RAM and Disk.
- Asynchronous Processing: Uploads are accepted instantly to provide a fast UX, while the security engine crunches the file in the background and updates the status (
PENDING->SAFEorREJECTED).
- Multi-Stage Docker: A unified root
Dockerfilethat builds the React frontend and statically serves it from the Node backend, deployed alongside MongoDB indocker-compose.yml. - CI/CD Pipeline: Pre-configured GitHub Actions (
.github/workflows/ci.yml) to automatically run Jest integration tests and linters on every push.
- Node.js (v18+)
- MongoDB (Local or Atlas)
- Docker (optional, for containerized deployment)
-
Clone the repository
git clone https://github.com/yourusername/SecureShield.git cd SecureShield -
Setup the Backend
cd server npm install # Copy the environment variables cp .env.example .env # Start the backend API on port 3000 npm run dev
-
Setup the Frontend
cd ../client npm install # Start the Vite development server on port 5173 npm run dev
To launch the entire application (Frontend, Backend, and MongoDB) in production mode using Docker:
docker-compose up --build -dThe application will be available at http://localhost:3000.
SecureShield comes with a built-in Malware Test Kit script to demonstrate the engine. While the backend is running, execute:
cd server
node scripts/seed.jsThis script will register an admin user, generate mock malicious files (a spoofed image, a zip bomb, an archive with a hidden executable, and an oversized file), and upload them via the API. Log in to the dashboard to watch the engine flag them!