A boilerplate starter project for building a Java Spring Boot application with File Storage Service. This template includes essential features for implementing a simple file storage service.
- File Storage Service
- File Upload
- File Download
- File Deletion
- File Metadata
- List Files with Pagination
- Swagger UI
- Logging with Logback
- Docker Compose for MySQL and Adminer
- Java 17+
- Maven
- Clone the repository:
git clone https://github.com/boboilerlabs/java-spring-file-storage
cd java-spring-file-storage
- Running with Maven
mvn spring-boot:run
- Using Swagger UI
Visit http://localhost:8080/swagger-ui.html to access the Swagger UI and try out the API endpoints.
To upload a file, send a POST request to /api/files/upload
with the file as a form-data:
curl -X POST "http://localhost:8080/api/files/upload" \
-H "Content-Type: multipart/form-data" \
-F "file=@/path/to/your/file.txt"
To download a file, send a GET request to /api/files/download/{fileId}
:
curl -X GET "http://localhost:8080/api/files/download/{fileId}" -o downloaded_file.txt
To delete a file, send a DELETE request to /api/files/delete/{fileId}
:
curl -X DELETE "http://localhost:8080/api/files/delete/{fileId}"
To list all files, send a GET request to /api/files
:
curl -X GET "http://localhost:8080/api/files?page=0&size=10"
To get the metadata of a file, send a GET request to /api/files/{fileId}
:
curl -X GET "http://localhost:8080/api/files/{fileId}"
We welcome contributions! Please see the CONTRIBUTING.md for more details.
This project is licensed under the MIT License - see the LICENSE file for details.