This is the backend server for a File Sharing Platform, providing secure file upload, sharing, and access management. This server handles API requests for file uploads, metadata storage, access control, logging, and file downloads. The backend is built with Nest.js and uses MongoDB to store metadata, with file storage.
- User Authentication: Secure signup, login, and JWT-based authorization.
- File Upload & Management: Handles file uploads and stores file metadata.
- Access Control: Allows users to set file access permissions and expiration dates for secure sharing.
- Download Logs: Tracks download activity for each file and stores logs for analytics.
- Shareable Links: Generates secure, password-protected links with optional expiration dates for sharing files.
- Search and Filtering: Enables file searching by name, type, tags, or metadata.
- Automatic Deletion: Cron job automatically deletes files from S3 and removes its metadata from MongoDB after the expiration date passes.
- Notifications: Users receive notifications (via email) before their file expires and once it's deleted.
- Backend Framework: Nest.js
- Database: MongoDB (MongoDB Atlas for cloud hosting)
- File Storage: Microsoft azure blob storage
- Authentication: JWT (JSON Web Tokens)
Prerequisites Node.js (>=14.x) Npm (>=10.x)
- Clone the Repository
git clone https://github.com/aifia105/file-sharing-backend.git
cd file-sharing-backend- Install Dependencies
npm installCreate a .env file in the root directory and add the following variables:
FRONTEND_URL
PORT
MONGODB_URI
JWT_SECRET
JWT_EXPIRATION
BCRYPT_SALT_ROUNDS
SESSION_SECRET
AZURE_STORAGE_CONNECTION_STRINGFor development:
npm run start:devFor production:
npm run start