Watch the application demonstration
A full-stack MERN (MongoDB, Express.js, React, Node.js) application that allows users to upload files and scan them for potentially dangerous content. The application uses a queue-based architecture for processing files asynchronously with a modern, responsive web interface.
- Node.js with TypeScript - Runtime environment and programming language
- Express.js - Web application framework
- MongoDB with Mongoose - Database and ODM
- BullMQ - Redis-based queue for handling file scanning jobs
- Multer - Middleware for handling file uploads
- CORS - Cross-Origin Resource Sharing middleware
- Next.js 15 - React framework with App Router
- React 19 - User interface library
- TypeScript - Type-safe development
- Tailwind CSS - Utility-first CSS framework
- Lucide React - Modern icon library
- React Hot Toast - Toast notifications
- Next Themes - Theme management
├── cyberxplore-backend/
│ ├── index.ts # Main application entry point
│ ├── models/
│ │ └── MetadataModel.ts # MongoDB schema for file metadata
│ ├── queues/
│ │ └── fileQueue.ts # BullMQ queue configuration
│ ├── routes/
│ │ ├── files.ts # API routes for fetching files
│ │ └── upload.ts # API routes for file upload
│ ├── uploads/ # Directory for stored files
│ └── workers/
│ └── fileWorker.ts # Worker process for file scanning
├── cyberxplore-frontend/
│ ├── app/
│ │ ├── dashboard/ # Dashboard page and components
│ │ │ ├── components/ # Dashboard-specific components
│ │ │ ├── page.tsx # Dashboard page
│ │ │ └── types.ts # TypeScript interfaces
│ │ ├── globals.css # Global styles
│ │ ├── layout.tsx # Root layout component
│ │ └── page.tsx # File upload page
│ ├── components/
│ │ └── theme-provider.tsx # Theme context provider
│ ├── lib/ # Utility functions
│ ├── public/ # Static assets
-
File Upload System
- Drag and drop file upload interface
- Supports PDF, DOCX, JPG, JPEG, and PNG files
- 5MB file size limit
- Real-time upload progress tracking
- Automatic file naming with timestamps
-
File Scanning System
- Asynchronous processing using BullMQ
- Scans for dangerous keywords ("rm -rf", "eval", "bitcoin")
- Progress tracking with job status updates
- Webhook notifications for infected files (optional)
-
Dashboard & File Management
- Modern, responsive dashboard interface
- Real-time file status monitoring with auto-refresh
- File filtering by status (all, pending, scanning, scanned)
- Pagination for large file lists
- Detailed file information modal
- Statistics cards showing scan results
- Toast notifications for status changes
-
User Experience
- Modern UI with Tailwind CSS
- Dark/Light theme support
- Toast notifications for user feedback
- Responsive design for all devices
- Seamless navigation between upload and dashboard
- Node.js (Latest LTS version)
- MongoDB
- Redis Server
- TypeScript
-
Clone the repository:
git clone <repository-url> cd CyberXplore Assignment
-
Install backend dependencies:
cd cyberxplore-backend npm install
-
Install frontend dependencies:
cd cyberxplore-frontend npm install
-
Environment Setup:
- Ensure MongoDB is running on localhost:27017 (or set MONGODB_URI env variable)
- Ensure Redis is running on localhost:6379 (or set REDIS_HOST and REDIS_PORT env variable)
- Optional: Set WEBHOOK_URL for malware notifications
-
Start the backend services:
cd cyberxplore-backend npm start
This will start both the main server and the worker process using
concurrently
.- Main server will run on http://localhost:8000
- File worker will process uploaded files asynchronously
-
Start the frontend development server:
cd cyberxplore-frontend npm run dev
The frontend will run on http://localhost:3000
-
Upload File
- POST
/upload
- Accepts multipart form data with field name "file"
- Returns file metadata including status
- POST
-
List Files
- GET
/files
- Returns list of all uploaded files with their scan status
- GET
- User uploads file through drag-and-drop or file selection interface
- Frontend sends file to backend API endpoint
- Multer middleware validates and stores file
- File metadata is saved to MongoDB
- File is queued for scanning using BullMQ
- Worker processes file and updates status
- Frontend receives real-time updates via polling
- Worker picks up file from queue
- Reads file content
- Checks for dangerous keywords ("rm -rf", "eval", "bitcoin")
- Updates metadata with scan results
- Sends webhook notification if file is infected (when configured)
- Next.js App Router: Modern routing with server components
- Real-time Updates: Auto-refresh dashboard every 5 seconds
- State Management: React hooks for component state
- Responsive Design: Mobile-first approach with Tailwind CSS
- Toast Notifications: User feedback for all operations
- Concurrent processing: 2 files
- Exponential backoff for failed jobs
- 3 retry attempts
- Keeps history of last 100 completed/failed jobs
express
: Web frameworkmongoose
: MongoDB ODMbullmq
: Redis-based queuemulter
: File upload handlingcors
: Cross-origin resource sharingconcurrently
: Run multiple commands concurrently
next
: React framework with App Routerreact
: User interface libraryreact-dom
: React DOM rendererlucide-react
: Modern icon libraryreact-hot-toast
: Toast notificationsnext-themes
: Theme managementtailwindcss
: Utility-first CSS frameworktailwindcss-animate
: Animation utilities
typescript
: Programming language@types/*
: TypeScript type definitionspostcss
: CSS post-processor@types/node
: Node.js type definitions
- File type validation (PDF, DOCX, JPG, JPEG, PNG only)
- File size limits (5MB maximum)
- Queue processing errors with retry mechanism
- MongoDB connection errors
- General API error handling with appropriate HTTP status codes
- Frontend error states with user-friendly messages