Skip to content

Spring Boot application interacting with Minio storage service, with functionality to upload, download, generate temporary URLs for files stored in a Minio bucket.

Notifications You must be signed in to change notification settings

javohirdeveloper0612/minio-file

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

11 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

MinIO File Service

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.

Features

  • File Upload: Allows users to upload files to the MinIO server.
  • File Download: Enables downloading of stored files.
  • File Metadata Management: Keeps track of file metadata through a database.
  • Error Handling: Custom exceptions are used to provide meaningful error messages.

Technologies Used

  • Java 17: Core programming language.
  • Spring Boot: Framework for building the RESTful API.
  • MinIO: Object storage system used for storing uploaded files.
  • Maven: Dependency management.
  • H2 Database: Embedded database for storing file metadata (can be replaced with other databases).

Project Structure

  • config: Contains configuration classes including MinIO connection properties.
  • controller: Handles incoming HTTP requests related to file operations.
  • domain: Represents entities, such as FileEntity, used to store file-related data.
  • repo: Manages database operations for storing and retrieving file metadata.
  • service: Contains services for interacting with MinIO and managing files.
  • utils: Utility classes for file operations.

Getting Started

Prerequisites

  • Java 17 or higher
  • Maven for building the project
  • MinIO Server running locally or accessible remotely

Installation

  1. Clone the repository

    git clone <repository-url>
    cd minio-file-service
  2. Set up MinIO configuration

    • Update the .env file or application.properties with your MinIO credentials (e.g., access key, secret key, and endpoint).
  3. Build the project

    ./mvnw clean install
  4. Run the application

    ./mvnw spring-boot:run

Usage

  • 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.
  • Download a File: Send a GET request to /api/files/download/{fileId} to retrieve a file.

Configuration

  • The application properties for connecting to MinIO are defined in the application.properties file.
  • You can modify the following settings:
    • minio.url: The URL of the MinIO server.
    • minio.access-key: Your MinIO access key.
    • minio.secret-key: Your MinIO secret key.

Error Handling

The application uses custom exceptions to handle errors, such as FileException and InvalidRequestException. These exceptions ensure meaningful messages are returned to users.

License

This project is licensed under the MIT License. See the LICENSE file for details.

Contributing

Contributions are welcome! Please open an issue or submit a pull request for any improvements or bug fixes.

Contact

For any issues or inquiries, please contact:

About

Spring Boot application interacting with Minio storage service, with functionality to upload, download, generate temporary URLs for files stored in a Minio bucket.

Topics

Resources

Stars

Watchers

Forks

Packages

No packages published

Languages