Files Manager is a comprehensive back-end project designed to simulate a real-world file storage and management platform. This project encapsulates essential back-end development skills, including user authentication, database operations with MongoDB, caching with Redis, and handling background tasks. It serves as a practical application of the back-end trimester knowledge acquired in the ALX Software Engineering program, focusing on JavaScript, Node.js, Express, MongoDB, and Redis.
The objective of this project is to create a platform that allows users to upload and manage files. Key features include:
- User Authentication: Secure user authentication using tokens.
- File Management: Ability to list, upload, change permissions, and view files.
- Image Processing: Generate thumbnails for uploaded images to enhance performance and user experience.
- Data Storage: Utilize MongoDB for persistent storage of user and file information.
- Caching: Implement Redis for efficient data caching, enhancing the application's performance.
- Background Processing: Use background jobs for tasks such as thumbnail generation and welcome email sending, ensuring the application remains responsive.
- Back-End: JavaScript (ES6), Node.js, Express.js
- Database: MongoDB (NoSQL database for storing user and file data)
- Cache: Redis (For caching and temporary data storage)
- Task Queue: Bull (For managing background jobs)
- Other Libraries: Mocha (for testing), Nodemon, Image-thumbnail, Mime-Types
-
Prerequisites:
- Node.js (version 12.x.x)
- MongoDB (Running on default port 27017 or set via environment variables)
- Redis (Running on default port or set via environment variables)
- Git
-
Clone the repository:
git clone https://github.com/your-github-username/alx-files_manager.git cd alx-files_manager
-
Install dependencies:
npm install
-
Environment Variables: Create a
.env
file in the root directory and set the following variables:PORT
: Port for the server (default: 5000)DB_HOST
: MongoDB host (default: localhost)DB_PORT
: MongoDB port (default: 27017)DB_DATABASE
: Database name (default: files_manager)FOLDER_PATH
: Path for storing uploaded files (default: /tmp/files_manager)
-
Running the application:
- Start the server:
npm start
- Start the worker (in a separate terminal):
npm run start-worker
- Start the server:
GET /status
: Check the health of the application.GET /stats
: Get statistics about users and files.POST /users
: Create a new user.GET /connect
: Authenticate a user.GET /disconnect
: Log out a user.- More endpoints for file management detailed in the API documentation.
controllers/
: Contains controller files for handling API endpoint logic.routes/
: Defines the API endpoints and associates them with their respective controllers.utils/
: Utility classes for database and caching operations.worker.js
: Background job processing.server.js
: Entry point for the application.
After succesfully running the application you can access the project on your command line using curl
to send requests to your server. Learn more about CURL
To access the project you must be authenticated first and your data must be stored/registered. Access the POST /users
route to create a new user.
This project is provided for educational purposes only. It is not affiliated with any actual file storage platform.
Author: Awwal Adetomiwa