Implementing Online File Preview with SpringBoot, MinIO, and kkFileView
This tutorial explains how to set up a SpringBoot application with MinIO storage and the kkFileView tool to achieve universal online file preview for various file types, using Docker containers and simple configuration steps.
kkFileView Overview
kkFileView is an open‑source universal online preview project built on SpringBoot, currently with over 21k stars on Gitee, easy to deploy and supports almost all common file types.
Installation
MinIO
Download the MinIO Docker image and run it, exposing the console on port 9001 and the service on port 9090.
docker pull minio/minio docker run -p 9090:9000 -p 9001:9001 --name minio \
-v /mydata/minio/data:/data \
-e MINIO_ROOT_USER=minioadmin \
-e MINIO_ROOT_PASSWORD=minioadmin \
-d minio/minio server /data --console-address ":9001"Access the console at http://192.168.3.101:9001 using the default credentials minioadmin:minioadmin .
kkFileView
Pull the kkFileView Docker image and run it on port 8012.
docker pull keking/kkfileview docker run -p 8012:8012 --name kkfileview -d keking/kkfileviewOpen the test page at http://192.168.3.101:8012.
Usage
Create a bucket named preview in MinIO, set its policy to Public , upload files, and access them via http://192.168.3.101:9090/{bucket}/{file} . Example: http://192.168.3.101:9090/preview/avatar.png .
File Preview
Use kkFileView’s online preview endpoint with a Base64‑encoded file URL:
http://192.168.3.101:8012/onlinePreview?url=base64Encode($url)The tool can preview images, Word, PDF, PPT, Markdown, Excel, and even the contents of zip archives, as shown in the screenshots.
Conclusion
The tutorial demonstrates how to achieve arbitrary file online preview in a SpringBoot project using MinIO and kkFileView without writing additional code.
Project address: https://gitee.com/kekingcn/file-online-preview
IT Services Circle
Delivering cutting-edge internet insights and practical learning resources. We're a passionate and principled IT media platform.
How this landed with the community
Was this worth your time?
0 Comments
Thoughtful readers leave field notes, pushback, and hard-won operational detail here.