This project is a comprehensive summary of the back-end trimester topics, covering authentication, NodeJS, MongoDB, Redis, pagination, and background processing. The objective is to build a simple platform for uploading and viewing files with functionalities such as user authentication via a token, listing all files, uploading new files, changing file permissions, viewing files, and generating thumbnails for images.
- Project Overview
- Features
- Learning Objectives
- Technologies Used
- Setup and Installation
- API Endpoints
- Usage
The File Management Platform is designed to provide users with the ability to manage their files securely and efficiently. It includes features such as:
- User authentication using tokens.
- Listing all uploaded files.
- Uploading new files.
- Changing file permissions.
- Viewing files.
- Generating thumbnails for image files.
- 🔐 User Authentication: Secure authentication mechanism using tokens.
- 📄 File Listing: List all uploaded files with pagination.
- 📤 File Upload: Upload new files to the platform.
- 🔄 Permission Management: Change the permissions of files (e.g., private, public).
- 👁️ File Viewing: View the content of uploaded files.
- 🖼️ Thumbnail Generation: Generate and view thumbnails for image files.
- ⚙️ Background Processing: Use background workers for processing tasks such as thumbnail generation.
By the end of this project, you should be able to:
-
Create an API with Express:
- Set up a Node.js server with Express.
- Define API endpoints for file management.
-
Authenticate a User:
- Implement token-based authentication.
- Secure API endpoints using authentication middleware.
-
Store Data in MongoDB:
- Connect to a MongoDB database.
- Perform CRUD operations on MongoDB collections.
-
Store Temporary Data in Redis:
- Set up Redis for caching and temporary data storage.
- Use Redis for session management and caching.
-
Setup and Use a Background Worker:
- Implement background processing using a worker library (e.g., Bull).
- Process tasks such as thumbnail generation in the background.
- Node.js: JavaScript runtime for building the server.
- Express.js: Web framework for building APIs.
- MongoDB: NoSQL database for storing file metadata.
- Redis: In-memory data structure store for caching and temporary data.
- Bull: Background job processing library.
- Multer: Middleware for handling file uploads.
- JWT: JSON Web Tokens for user authentication.
- Clone the Repository:
git clone https://github.com/your-username/file-management-platform.git cd file-management-platform
- Install Dependencies:
npm install
- Set Up Environment Variables:
Create a .env file in the root directory and add the following environment variables:
PORT=3000 MONGODB_URI=mongodb://localhost:27017/file_management REDIS_URL=redis://localhost:6379 JWT_SECRET=your_jwt_secret
- Start the Server:
npm start