A full-stack application for efficient media file management using AWS S3 storage. The project consists of a custom NodeJS backend server (without Express) and a modern Next.js frontend interface.
This project implements a media management service that allows users to:
- Upload media files to AWS S3
- View and manage uploaded files
- Update existing files
- Delete files from storage
- Preview supported media types
The project is structured as a monorepo with two main components:
S3-Media-Service/
├── backend/ # Custom NodeJS server
├── frontend/ # Next.js web interface
└── docker-compose.yml
-
Custom HTTP Server
- Pure NodeJS implementation (no Express)
- Custom router for API endpoints
- Support for GET, POST, PUT, DELETE methods
- Efficient file upload handling
-
AWS S3 Integration
- Direct file uploads to S3
- Secure file retrieval
- Metadata management
- Large file handling
-
Security & Validation
- File type validation
- Error handling
- Request logging
- Environment-based configuration
-
Modern UI/UX
- Responsive design
- Real-time upload progress
- File preview capabilities
- Error state handling
-
Technical Implementation
- Built with Next.js 14
- TypeScript for type safety
- Tailwind CSS for styling
- Clean component architecture
- Node.js 18.x or later
- AWS Account with S3 access
- Docker and Docker Compose (optional)
- Git
- Clone the repository:
git clone https://github.com/SashaMarchuk/S3-Media-Service.git
cd S3-Media-Service- Set up environment variables:
# Backend (.env)
cp backend/.env.example backend/.env
# Frontend (.env.local)
cp frontend/.env.example frontend/.env.local- Configure AWS credentials in backend/.env:
AWS_ACCESS_KEY_ID=your_access_key_id
AWS_SECRET_ACCESS_KEY=your_secret_access_key
AWS_REGION=your_region
AWS_BUCKET_NAME=your_bucket_name
The easiest way to run the entire stack:
docker-compose up --buildThis will start:
- Backend server on http://localhost:3001
- Frontend application on http://localhost:3000
cd backend
npm install
npm startcd frontend
npm install
npm run dev- POST
/api/media - Content-Type: multipart/form-data
- Returns:
{ fileId, url, message, contentType, size }
- GET
/api/media - Query params:
page,limit - Returns:
{ files: [], totalFiles, currentPage, totalPages }
- PUT
/api/media/:fileId - Content-Type: multipart/form-data
- Returns:
{ fileId, url, message, contentType, size }
- DELETE
/api/media/:fileId - Returns:
{ message: "File deleted successfully" }
- Images: JPEG, PNG, GIF
- Videos: MP4, MOV
- Documents: PDF, DOCX
- Environment-based configuration
- File type validation
- Secure S3 access
- Error handling for all endpoints
# Backend tests
cd backend
npm test
# Frontend tests
cd frontend
npm testThe application can be deployed using:
- Docker containers (recommended)
- Manual deployment
- Cloud services (AWS ECS, Heroku, etc.)
Detailed deployment instructions are available in DEPLOYMENT.md.
- Fork the repository
- Create your feature branch
- Commit your changes
- Push to the branch
- Create a Pull Request
- Custom HTTP Server Implementation
- AWS S3 Integration
- File Operations (CRUD)
- Metadata Storage
- File Type Validation
- Error Handling
- Logging
- Documentation
- Modern Frontend Interface
- Docker Support
This project is licensed under the MIT License - see the LICENSE file for details.
Sasha Marchuk
- GitHub: @SashaMarchuk