|
| 1 | + |
| 2 | +# MinIO File Service |
| 3 | + |
| 4 | +This project is a Java Spring Boot application that integrates MinIO, an open-source object storage service. The application provides functionalities for managing file uploads, storage, and retrieval, using MinIO as a storage backend. |
| 5 | + |
| 6 | +## Features |
| 7 | + |
| 8 | +- **File Upload**: Allows users to upload files to the MinIO server. |
| 9 | +- **File Download**: Enables downloading of stored files. |
| 10 | +- **File Metadata Management**: Keeps track of file metadata through a database. |
| 11 | +- **Error Handling**: Custom exceptions are used to provide meaningful error messages. |
| 12 | + |
| 13 | +## Technologies Used |
| 14 | + |
| 15 | +- **Java 11**: Core programming language. |
| 16 | +- **Spring Boot**: Framework for building the RESTful API. |
| 17 | +- **MinIO**: Object storage system used for storing uploaded files. |
| 18 | +- **Maven**: Dependency management. |
| 19 | +- **H2 Database**: Embedded database for storing file metadata (can be replaced with other databases). |
| 20 | + |
| 21 | +## Project Structure |
| 22 | + |
| 23 | +- **`config`**: Contains configuration classes including MinIO connection properties. |
| 24 | +- **`controller`**: Handles incoming HTTP requests related to file operations. |
| 25 | +- **`domain`**: Represents entities, such as `FileEntity`, used to store file-related data. |
| 26 | +- **`repo`**: Manages database operations for storing and retrieving file metadata. |
| 27 | +- **`service`**: Contains services for interacting with MinIO and managing files. |
| 28 | +- **`utils`**: Utility classes for file operations. |
| 29 | + |
| 30 | +## Getting Started |
| 31 | + |
| 32 | +### Prerequisites |
| 33 | + |
| 34 | +- **Java 11** or higher |
| 35 | +- **Maven** for building the project |
| 36 | +- **MinIO Server** running locally or accessible remotely |
| 37 | + |
| 38 | +### Installation |
| 39 | + |
| 40 | +1. **Clone the repository** |
| 41 | + ```bash |
| 42 | + git clone <repository-url> |
| 43 | + cd minio-file-service |
| 44 | + ``` |
| 45 | + |
| 46 | +2. **Set up MinIO configuration** |
| 47 | + - Update the `.env` file or `application.properties` with your MinIO credentials (e.g., access key, secret key, and endpoint). |
| 48 | + |
| 49 | +3. **Build the project** |
| 50 | + ```bash |
| 51 | + ./mvnw clean install |
| 52 | + ``` |
| 53 | + |
| 54 | +4. **Run the application** |
| 55 | + ```bash |
| 56 | + ./mvnw spring-boot:run |
| 57 | + ``` |
| 58 | + |
| 59 | +### Usage |
| 60 | + |
| 61 | +- **Upload a File**: Use an API client like Postman to send a `POST` request to `/api/files/upload` with the file in the request body. |
| 62 | +- **Download a File**: Send a `GET` request to `/api/files/download/{fileId}` to retrieve a file. |
| 63 | + |
| 64 | +## Configuration |
| 65 | + |
| 66 | +- The application properties for connecting to MinIO are defined in the `application.properties` file. |
| 67 | +- You can modify the following settings: |
| 68 | + - `minio.url`: The URL of the MinIO server. |
| 69 | + - `minio.access-key`: Your MinIO access key. |
| 70 | + - `minio.secret-key`: Your MinIO secret key. |
| 71 | + |
| 72 | +## Error Handling |
| 73 | + |
| 74 | +The application uses custom exceptions to handle errors, such as `FileException` and `InvalidRequestException`. These exceptions ensure meaningful messages are returned to users. |
| 75 | + |
| 76 | +## License |
| 77 | + |
| 78 | +This project is licensed under the MIT License. See the `LICENSE` file for details. |
| 79 | + |
| 80 | +## Contributing |
| 81 | + |
| 82 | +Contributions are welcome! Please open an issue or submit a pull request for any improvements or bug fixes. |
| 83 | + |
| 84 | +## Contact |
| 85 | + |
| 86 | +For any issues or inquiries, please contact: |
| 87 | + |
| 88 | +- **Developer Name:** Javohir Yallayev |
| 89 | +- **Email:** javoxiryallayev1@gmail.com |
| 90 | +- **GitHub:** [javohirdeveloper0612](https://github.com/javohirdeveloper0612) |
0 commit comments