File Hosting App
This is a T3 Stack project. It provides a file hosting service where users can upload, download, and manage files.
Features
- User authentication with NextAuth.js
- File upload and download using MinIO
- File metadata management with Prisma
- Real-time updates using Server-Sent Events (SSE)
- Responsive UI built with Tailwind CSS
Technologies Used
API Documentation
Download File
Endpoint: /api/files/download
Method: GET
Query Parameters:
fileId(required): The ID of the file to download.fileName(required): The name of the file to download.
Response:
- 200 OK: Returns the file as a binary stream.
- 400 Bad Request: If
fileIdorfileNameis missing. - 404 Not Found: If the file does not exist.
- 500 Internal Server Error: If there is an error fetching the file.
Serve File
Endpoint: /api/files/serv
Method: GET
Query Parameters:
id(required): The ID of the file to serve.
Response:
- 200 OK: Returns the file as a binary stream with the appropriate MIME type.
- 400 Bad Request: If
idis missing. - 404 Not Found: If the file does not exist.
- 500 Internal Server Error: If there is an error fetching the file.
List Files
Endpoint: /api/files
Method: GET
Response:
- 200 OK: Returns a list of files with metadata.
- 500 Internal Server Error: If there is an error fetching the files.
Real-Time Updates
Endpoint: /api/files/stream
Method: GET
Response:
- 200 OK: Streams real-time updates for file additions and removals.
How to Run Locally
- Clone the repository:
git clone https://github.com/your-username/file-hosting.git cd file-hosting npm install npm run build npm run start
Description
Languages
TypeScript
55.4%
JavaScript
41.2%
Shell
2%
Dockerfile
1.1%
CSS
0.3%