CDN File Uploader is a file upload service built with Node.js and Express. It supports multiple file types, validates uploads by MIME type and extension, and can store files through local storage or Firebase Storage.
The project was built as a practical backend utility for handling uploads in a more controlled way, with configurable storage behavior and a simple route for accessing uploaded files.
Overview
The API accepts uploaded files through a POST /upload endpoint and serves uploaded files through a /file route. It supports common file categories such as images, GIFs, documents, presentations, spreadsheets, and videos.
The service is configurable through environment variables, which makes it possible to switch between local storage and Firebase Storage without changing the core upload flow.
Problem
File uploads are a common requirement, but an unsafe upload flow can quickly become a security and maintenance problem. A useful uploader needs validation, predictable storage behavior, and a consistent way to access files after upload.
The goal of this project was to create a reusable upload service that can validate allowed file types, support different storage backends, and remain simple enough to deploy or extend.
Role
I designed and implemented the Express server, upload route, validation flow, storage configuration, and deployment setup.
The project also includes environment configuration and documentation for local usage, Firebase setup, and Vercel deployment.
Stack
- Node.js for the runtime
- Express for the HTTP server
- Multer for handling
multipart/form-data - File System storage for local uploads
- Firebase Admin SDK for Firebase Storage support
- dotenv for environment configuration
- Vercel for deployment support
Features
- Upload images, GIFs, documents, presentations, spreadsheets, and videos
- Validate files by MIME type and extension
- Store files locally or in Firebase Storage
- Configure behavior through environment variables
- Serve uploaded files through a consistent
/fileroute - Deploy with Vercel using included configuration
Supported File Types
The uploader supports common media and document formats:
- Images:
.jpeg,.jpg,.png,.gif - Documents:
.pdf,.doc,.docx - Presentations:
.ppt,.pptx - Spreadsheets:
.xls,.xlsx - Videos:
.mp4,.avi,.mov,.mkv
Storage Strategy
The project supports two storage modes:
| Storage | Purpose |
|---|---|
local | Store files in the server filesystem under uploads/ |
firebase | Store files in Firebase Storage |
Both modes expose files through the same /file route so the consumer does not need to care which storage backend is active.
Implementation Notes
The project is structured around clear separation between routes, controllers, middleware, configuration, and utilities. This keeps the upload flow easier to inspect and extend.
Validation is an important part of the implementation. Only selected file categories are allowed, reducing the risk of arbitrary file uploads and making the API behavior more predictable.
Outcome
The result is a configurable upload service that demonstrates Express routing, Multer-based upload handling, file validation, local storage, Firebase Storage integration, and deployment readiness.
It can be used as a starter for internal file tools, upload services, media handling experiments, or a base for a more complete CDN-style file management system.