A modern, feature-rich static file server built with Express.js, featuring file upload, pagination, progress tracking, and an intuitive web interface.
- 📤 Multiple File Upload - Upload single or multiple files with drag-and-drop support
- 📊 Real-time Progress Tracking - Individual progress bars for each file upload
- 📄 Pagination - Browse files with configurable pagination (10, 50, or 100 files per page)
- 💾 File Management - View, download, and delete files through a clean web interface
- 📈 Summary Dashboard - Real-time statistics showing total files and storage used
- 🔒 Input Validation - Built-in security and validation middleware
- 📝 Comprehensive Logging - Structured logging for all operations
- 🎨 Modern UI - Responsive design with smooth animations
expressfs/
├── app.js # Main application entry point
├── config/
│ └── config.js # Application configuration
├── middleware/
│ ├── errorHandler.js # Error handling middleware
│ └── validator.js # Request validation middleware
├── routes/
│ └── fileRoutes.js # File management API routes
├── utils/
│ ├── logger.js # Logging utility
│ └── fileHelper.js # File operations helper
├── public/
│ ├── index.html # Main HTML page
│ ├── css/
│ │ └── styles.css # Application styles
│ └── js/
│ └── app.js # Frontend JavaScript
├── store/ # File storage directory
├── package.json # Dependencies and scripts
├── .env.example # Environment variables example
└── README.md # This file
- Node.js (v14 or higher)
- npm or yarn
- Clone the repository:
git clone <repository-url>
cd expressfs- Install dependencies:
npm install- Create environment file (optional):
cp .env.example .env
# Edit .env with your preferred settings- Start the server:
npm start- Open your browser and navigate to:
http://localhost:8080
Configuration can be set via environment variables or by editing config/config.js.
PORT- Server port (default: 8080)HOST- Server host (default: 0.0.0.0)NODE_ENV- Environment mode (development/production)MAX_FILE_SIZE- Maximum file size in human-readable format (default: 5GB)- Supports: KB, MB, GB, TB (case-insensitive)
- Examples: "5GB", "100MB", "1.5TB", "500KB"
STORE_DIRECTORY- Directory for uploaded files (default: store)
Edit config/config.js to customize:
- Server settings - Port, host
- Upload limits - Max file size, allowed extensions
- Pagination - Default items per page, allowed limits
- Logging - Enable/disable logging, timestamp format
Get paginated list of files with metadata.
Query Parameters:
page- Page number (default: 1)limit- Items per page (10, 50, or 100)
Response:
{
"files": [...],
"pagination": {
"currentPage": 1,
"totalPages": 5,
"totalFiles": 42,
"totalSize": 1048576,
"filesPerPage": 10,
"hasNextPage": true,
"hasPrevPage": false
}
}Upload single or multiple files.
Request: multipart/form-data with target_file field
Response:
{
"success": true,
"message": "Successfully uploaded 3 file(s)",
"results": [...]
}Delete multiple files.
Request Body:
{
"files": ["file1.txt", "file2.pdf"]
}Response:
{
"success": true,
"message": "Files deleted successfully",
"results": [...]
}docker build -t expressfs:latest .docker run -d -p 8080:8080 --name expressfs expressfs:latestversion: '3.8'
services:
expressfs:
image: expressfs:latest
ports:
- "8080:8080"
volumes:
- ./store:/app/store
environment:
- NODE_ENV=production
- PORT=8080Deploy ExpressFS to OpenShift with a single command:
oc apply -f openshift/expressfs-deployment.yamlThis creates:
- Deployment with health checks and resource limits
- Service for internal cluster communication
- Route for external access
- PersistentVolumeClaim (10Gi) for file storage
# Get the route URL
oc get route expressfs -o jsonpath='{"https://"}{.spec.host}{"\n"}'# Check all resources
oc get all -l app=expressfs
# View logs
oc logs -l app=expressfs -fFor comprehensive deployment instructions, troubleshooting, scaling, monitoring, and advanced configuration, see:
The guide includes:
- Step-by-step deployment instructions
- Configuration options
- Scaling and updates
- Troubleshooting tips
- Security best practices
- Backup and restore procedures
- Advanced configurations
NODE_ENV=development npm startnpm start- Start the servernpm test- Run tests (to be implemented)
- File upload size limits are enforced
- Filename validation prevents directory traversal attacks
- Input validation on all API endpoints
- CORS can be configured in
app.jsif needed - Consider adding authentication for production use
- Static files are served with Express static middleware
- Pagination reduces memory usage for large file lists
- Async/await pattern for non-blocking operations
- Efficient file streaming for uploads
Change the port in .env or config/config.js
- Check file size limits in configuration
- Ensure
storedirectory has write permissions - Check available disk space
- Verify
storedirectory exists - Check file permissions
- Review server logs for errors
Contributions are welcome! Please follow these steps:
- Fork the repository
- Create a feature branch
- Make your changes
- Test thoroughly
- Submit a pull request
ISC License
Daniel Istrate
- 2.0.0 - Major refactor with modular architecture, pagination, multi-file upload
- 1.0.0 - Initial release with basic file upload/download functionality
For issues and questions, please open an issue on the repository.