Code Monkey home page Code Monkey logo

alx-files_manager's Introduction

Files Manager

Files Manager is a Node.js application for managing files with user authentication, file uploads, image processing, and file sharing functionalities. It uses technologies like Node.js, Express.js, MongoDB for database management, Redis for caching, and Bull for background job processing.

Features

  • User authentication (sign-up, sign-in, sign-out)
  • File management (uploading, downloading, listing, updating, deleting)
  • Image processing (thumbnail generation)
  • File sharing (public/private files)

Technologies Used

  • Node.js - Server-side JavaScript runtime
  • Express.js - Web application framework for Node.js
  • MongoDB - NoSQL database for storing file metadata
  • Redis - In-memory data structure store for caching
  • Bull - Redis-backed queue for handling background jobs
  • Mongoose - MongoDB object modeling for Node.js
  • Image-Thumbnail - Node.js module for generating image thumbnails
  • bcrypt - Library for hashing passwords
  • jsonwebtoken - JSON Web Token (JWT) implementation for user authentication
  • multer - Middleware for handling file uploads
  • chai and mocha - Testing framework and assertion library for Node.js applications

Prerequisites

  • Node.js (v12 or higher)
  • MongoDB database
  • Redis server

Installation

  1. Clone the repository:

git clone https://github.com/your-username/files-manager.git cd files-manager

  1. Install dependencies:

npm install

  1. Set up environment variables:

Create a .env file in the root directory and provide the following variables:

PORT=3000 MONGODB_URI=mongodb://localhost:27017/files_manager REDIS_URL=redis://localhost:6379 FOLDER_PATH=/tmp/files_manager

Adjust the MongoDB URI, Redis URL, and folder path as per your configuration.

  1. Start the application:

npm start

The application should now be running on http://localhost:3000.

  1. Run tests:

npm test

API Endpoints

#Authentication

  • POST /users - Create a new user
  • GET /connect - Sign in with Basic Auth and receive a JWT token
  • GET /disconnect - Sign out and invalidate JWT token
  • GET /users/me - Retrieve current user details

File Management

  • POST /files - Upload a new file
  • GET /files/:id - Retrieve file details by ID
  • GET /files - Retrieve all files with pagination
  • PUT /files/:id/publish - Publish a file
  • PUT /files/:id/unpublish - Unpublish a file
  • GET /files/:id/data - Retrieve file content by ID with optional size parameter for images

Image Processing

  • Automatically generates thumbnails for uploaded images in the background using Bull and Redis.

License

  • This project is licensed under the MIT License - see the LICENSE file for details.

Author

  • Joseph Orokpo

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.