{"id":20337123,"url":"https://github.com/fless-lab/file-nest","last_synced_at":"2025-04-11T22:41:28.094Z","repository":{"id":211485272,"uuid":"729094158","full_name":"fless-lab/file-nest","owner":"fless-lab","description":"File Management Server","archived":false,"fork":false,"pushed_at":"2023-12-13T20:22:09.000Z","size":44,"stargazers_count":9,"open_issues_count":0,"forks_count":2,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-03-25T18:41:18.839Z","etag":null,"topics":["express","mongodb","nodejs"],"latest_commit_sha":null,"homepage":"","language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/fless-lab.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null}},"created_at":"2023-12-08T11:55:49.000Z","updated_at":"2024-03-19T13:23:25.000Z","dependencies_parsed_at":"2023-12-08T21:38:55.693Z","dependency_job_id":null,"html_url":"https://github.com/fless-lab/file-nest","commit_stats":null,"previous_names":["fless-lab/file-nest"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/fless-lab%2Ffile-nest","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/fless-lab%2Ffile-nest/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/fless-lab%2Ffile-nest/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/fless-lab%2Ffile-nest/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/fless-lab","download_url":"https://codeload.github.com/fless-lab/file-nest/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248493022,"owners_count":21113159,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["express","mongodb","nodejs"],"created_at":"2024-11-14T21:08:05.815Z","updated_at":"2025-04-11T22:41:28.068Z","avatar_url":"https://github.com/fless-lab.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# File Nest - File Management Server\n\nWelcome to File Nest, a file management server developed using Node.js, Express, MongoDB, and HMAC authentication for secure operations.\n\n## Table of Contents\n\n- [Introduction](#introduction)\n- [Features](#features)\n- [Prerequisites](#prerequisites)\n- [Installation](#installation)\n- [Configuration](#configuration)\n- [Usage](#usage)\n- [API Routes](#api-routes)\n- [HMAC Authentication](#hmac-authentication)\n- [Logical File Deletion](#logical-file-deletion)\n- [Permanent File Deletion](#permanent-file-deletion)\n- [Restoration of Deleted Files](#restoration-of-deleted-files)\n- [Usage Tutorial](#usage-tutorial)\n- [Demo Video](#demo-video)\n- [Concrete Example](#concrete-example)\n- [Contributions](#contributions)\n- [License](#license)\n\n## Introduction\n\nThe File Nest server is designed to provide secure and centralized file storage, accessible via a RESTful API. It allows for the storage, retrieval, and deletion of files while ensuring security through HMAC authentication.\n\n## Features\n\n- Centralized file storage.\n- Secure authentication via HMAC.\n- RESTful API for simple operations.\n- Support for large storage volumes and requests.\n- Utilization of Node.js and MongoDB for speed and flexibility.\n\n## Prerequisites\n\nMake sure you have the following installed on your machine:\n\n- Node.js\n- MongoDB\n\n## Installation\n\n1. Clone the repository: `git clone https://github.com/fless-lab/file-nest.git`\n2. Navigate to the directory: `cd file-nest`\n3. Install dependencies: `npm install`\n\n## Configuration\n\nCreate a `.env` file at the root of the project with the following configurations:\n\n```makefile\nPORT=9330\nMONGO_URI=mongodb://localhost:27017\nDB_NAME=file-nest\nHMAC_SECRET=yourHmacSecret\nGARBAGE_COLLECTION_INTERVAL=86400000 # Daily automatic cleanup (in milliseconds)\nPERMANENT_DELETE_DELAY=604800000 # Delay for permanent deletion (7 days in milliseconds)\n```\n\n## Usage\n\nRun the application: `npm start`\nThe application is now accessible at [http://localhost:9330](http://localhost:9330)\n\n## API Routes\n\n- **POST /files** : Uploads a file.\n- **GET /files/:id** : Retrieves a file.\n- **DELETE /files/:id** : Deletes a file.\n- **DELETE /files/permanent/:id** : Permanently deletes a file.\n- **PATCH /files/restore/:id** : Restores a deleted file.\n- **GET /metadata/:id** : Retrieves file metadata [Not yet implemented].\n\n## HMAC Authentication\n\nHMAC authentication is used to ensure the security of operations. Make sure to use the HMAC secret key specified in the `.env` file.\n\n## Logical File Deletion\n\nFile Nest supports logical file deletion. Deleted files are not immediately removed but are marked for deletion. \nAutomatic cleanup of marked files is performed periodically.\n\n## Permanent File Deletion\n\nFile Nest supports permanent file deletion. Once done, these files are no longer accessible and are permanently removed from File Nest.\n\n## Restoration of Deleted Files\n\nFile Nest supports file restoration. Logically deleted files can be restored [if the garbage collector has not yet passed to permanently delete them].\n\n## Usage Tutorial\n\nWelcome to the File Nest usage tutorial. This guide will show you how to use the basic features of File Nest to manage your files securely.\n\n### 1. Upload a file\n\nTo upload a file to File Nest, use the POST method on the `/files` endpoint. Make sure to include your file in the request body. Here's an example using curl:\n\n```bash\ncurl -X POST \\\n  -H \"Content-Type: application/json\" \\\n  -H \"x-hmac-signature: YOUR_HMAC_SIGNATURE\" \\\n  -d '{\"content\": \"Base64_encoded_file_content\"}' \\\n  http://localhost:9330/files\n```\n\nMake sure to replace `YOUR_HMAC_SIGNATURE` with your actual HMAC signature.\n\n### 2. Retrieve a file\n\nTo retrieve a file from File Nest, use the GET method on the `/files/:id` endpoint. Replace `:id` with the ID of the file you want to retrieve. Here's an example using curl:\n\n```bash\ncurl -X GET \\\n  -H \"x-hmac-signature: YOUR_HMAC_SIGNATURE\" \\\n  http://localhost:9330/files/FILE_ID\n```\n\nMake sure to replace `YOUR_HMAC_SIGNATURE` and `FILE_ID` with the appropriate values.\n\n### 3. Delete a file\n\nTo logically delete a file, use the DELETE method on the `/files/:id` endpoint. Here's an example using curl:\n\n```bash\ncurl -X DELETE \\\n  -H \"x-hmac-signature: YOUR_HMAC_SIGNATURE\" \\\n  http://localhost:9330/files/FILE_ID\n```\n\nMake sure to replace `YOUR_HMAC_SIGNATURE` and `FILE_ID` with the appropriate values.\n\n### 4. Permanently delete a file\n\nTo permanently delete a file, use the DELETE method on the `/files/permanent/:id` endpoint. Here's an example using curl:\n\n```bash\ncurl -X DELETE \\\n  -H \"x-hmac-signature: YOUR_HMAC_SIGNATURE\" \\\n  http://localhost:9330/files/permanent/FILE_ID\n```\n\nMake sure to replace `YOUR_HMAC_SIGNATURE` and `FILE_ID` with the appropriate values.\n\n### 5. Restore a file\n\nTo restore a previously deleted file, use the PATCH method on the `/files/restore/:id` endpoint. Here's an example using curl:\n\n```bash\ncurl -X PATCH \\\n  -H \"x-hmac-signature: YOUR_HMAC_SIGNATURE\" \\\n  http://localhost:9330/files/restore/FILE_ID\n```\n\nMake sure to replace `YOUR_HMAC_SIGNATURE` and `FILE_ID` with the appropriate values.\n\n## Demo Video\n\nFor a visual demonstration of File Nest features, you can watch our video on [YouTube - File Nest Demo](https://www.youtube.com/@raoufcode).\n\n## Concrete Example\n\nWant a concrete example of using File Nest with another project that has both a backend and a frontend? Check out this repo 👉 [Github - File Nest Usage Example](https://www.github.com/fless-lab/file-nest-usage-example).\n\n## Contributions\n\nContributions are welcome! To contribute, follow these steps:\n\n1. Fork the project\n2. Create a branch for your feature (`git checkout -b feature/NewFeature`)\n3. Commit your changes (`git commit -m 'Add a new feature'`)\n4. Push to the branch (`git push origin feature/NewFeature`)\n5. Create a Pull Request\n\nThank you for contributing to File Nest!\n\n## License\n\nThis project is licensed under the [MIT License](LICENSE).","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ffless-lab%2Ffile-nest","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Ffless-lab%2Ffile-nest","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ffless-lab%2Ffile-nest/lists"}