A modern web-based file sharing platform with user authentication and role-based access control.
- User Registration: Users can create accounts with username and password
- Secure Login: Password hashing using bcrypt
- Session Management: Secure session-based authentication
- Role-Based Access Control: Two user roles (Admin and User)
- File Upload: Drag & drop or click to browse (Admin only)
- File Sharing: All authenticated users can view and download shared files
- File Deletion: Administrators can delete files
- File Search: Search functionality to filter files
- Multiple File Support: Upload multiple files at once
- Modern UI: Clean and responsive design with gradient backgrounds
- Real-time Updates: File list updates automatically
- User Dashboard: Shows user information and role badge
- Responsive Design: Works on different screen sizes
- Node.js (v12 or higher) - Download here
- npm (comes with Node.js)
-
Clone or download the repository
cd FileServer -
Install dependencies
npm install
-
Start the server
npm start
Or:
node fileServer.js [port]
Default port is 3000 if not specified.
-
Access the application
- Open your browser and navigate to:
http://localhost:3000 - Or from another machine on the same network:
http://your_ip_address:3000
- Open your browser and navigate to:
A default administrator account is created automatically:
- Username:
admin - Password:
admin
- Upload files
- View all shared files
- Download files
- Delete files
- Full access to all features
- View all shared files
- Download files
- Limited access (no upload/delete)
- Start the server using
npm start - Navigate to the login page
- Login with the default admin credentials
- Upload files using the drag & drop area
- Register new users from the registration page
-
Upload Files:
- Click on the upload area or drag & drop files
- Select multiple files if needed
- Click "Upload Files" button
-
Manage Files:
- View all shared files in the list
- Search for specific files using the search bar
- Delete files using the "Delete" button
- Download files using the "Download" button
-
View Files:
- Login to your account
- Browse all shared files
- Use the search bar to find specific files
-
Download Files:
- Click the "Download" button on any file
- Or click "Open" for PDF and JS files to view in browser
FileServer/
├── fileServer.js # Main server file
├── package.json # Dependencies and scripts
├── users.json # User database (auto-generated)
├── Share/ # Directory for shared files
├── Record/ # Directory for chat records
├── views/ # EJS templates
│ ├── index.ejs # Main application page
│ ├── login.ejs # Login page
│ └── register.ejs # Registration page
├── scripts/ # Client-side JavaScript
│ ├── script.js # Main application logic
│ └── query.js # Additional utilities
└── styles/ # CSS stylesheets
└── style.css # Main stylesheet
The server runs on port 3000 by default. To use a different port:
node fileServer.js 8080Users are stored in users.json in the project root. The file is automatically created with a default admin user on first run.
Uploaded files are stored in the Share/ directory. Make sure this directory has write permissions.
- Passwords are hashed using bcrypt (10 rounds)
- Sessions expire after 24 hours
- File uploads are restricted to administrators only
- File deletion requires administrator privileges
- All routes are protected with authentication middleware
- express: Web framework
- express-session: Session management
- bcrypt: Password hashing
- multer: File upload handling
- ejs: Template engine
- fs-extra: Enhanced file system operations
- body-parser: Request body parsing
Check the Docker configuration in prod/docker/dockerfile for containerized deployment.
Use prod/windows/runInBackground.vbs to run the server as a background service on Windows.
- Progress bar while uploading
- Folder upload support
- File type filtering (documents, images, software, etc.)
- User-specific file permissions
- File versioning
- Activity logs
- Email notifications
- Two-factor authentication
- API endpoints for programmatic access
This project is open source and available for use and modification.
For issues or questions, please check the code comments or create an issue in the repository.