This project is a Spring Boot based REST API implementation that provides a minimal package repository system for the Repsy programming language. The project supports uploading and downloading packages required by the Repsy package manager.
Table of Contents
This project is a backend API implementation that supports file upload and download operations. Files can be stored with two different strategies:
-
On File System
-
On Object Storage using MinIO
The metadata of each uploaded file is saved in the PostgreSQL database.
- Deployment REST API Endpoints:
- URL:
/{packageName}/{version}: Package deployment endpoint. - Enables the upload of package.rep (binary zip file) and meta.json (package metadata) files.
- The uploaded meta.json file is verified and saved to the PostgreSQL database.
- Files are saved to MinIO or file system depending on the selected storage strategy.
- URL:
- Download REST Endpoint:
- URL:
/{packageName}/{version}/{fileName}: Package download endpoint. - Enables the download of uploaded files.
- URL:
- Storage Layer:
- Packages and metadata can be stored in both the file system and in the object store using MinIO.
- The storage method can be configured via
application.propertiesor an environment variable.
- Database:
- PostgreSQL database is used to store metadata of deployed packages.
- Docker Support:
- The application is packaged as a Docker container and configured to work with PostgreSQL and MinIO services using docker-compose.
- Technical Details:
- Developed using Java LTS version (Java 17) and Spring Boot.
- Packaged as a Docker container.
- Java 17: Main programming language used for backend logic.
- Spring Boot v3.4.4: Used for rapid development of RESTful services.
- Spring Data JPA: A Spring module that simplifies database operations.
- PostgreSQL: Used as a database management system.
- Maven (For PostgreSQL ve MinIO): Project dependency management and compilation operations.
- Docker & Docker Compose: Used to run the application and MySQL database as a container.
- Swagger / Postman: Testable API
📦 repsy-assignment/
├── 📂 file-system-storage # storage-file-system module
├── 📂 main-api-app/ # Main Spring Boot Application
├────├── 📂 storage/
├────────├── 📂 files # Storage files
├── 📂 object-storage # storage-object-storage module
├── 📂 storage-common # Common interface
├── 📄 docker-compose.yml # Docker settings
└── 📄 README.md # Documentation
-
Main Spring Boot Application → main-api-app/
-
REST API endpoints
-
Business logic and services
-
-
Storage Strategy Libraries
-
storage-file-system module → file-system-storage/
-
storage-object-storage module → object-storage/
-
These libraries are deployed to the Repsy private Maven repository and are used by the main application.
-
-
Dockerfile and docker-compose.yml
- Enables all services (application, PostgreSQL, MinIO) to stand up easily.
To run the project, you must have the following software installed on your system:
- Java 17 or later
- Maven 3.8 or later
- Docker and Docker Compose (For PostgreSQL ve MinIO)
- IntelliJ IDEA or another IDE
- PostgreSQL or another compatible SQL database
- Swagger or Postman
-
Clone the project:
git clone https://github.com/irem-yigit/repsy-package-api.git
-
Configure the database:
- Create a database named
repsy(this step is not necessary if running with Docker). - Update the
application.propertiesfile in thesrc/main/resourcesfolder according to your database information.
- Create a database named
-
Run the following services with Docker:
→ PostgreSQL
docker run --name repsy-postgres -e POSTGRES_PASSWORD=postgres -e POSTGRES_DB=repsy -p 5432:5432 -d postgres
→ MinIO
docker run -p 9000:9000 -p 9001:9001 --name repsy-minio \
- -e "MINIO_ROOT_USER=minio" \
- -e "MINIO_ROOT_PASSWORD=minio123" \
- quay.io/minio/minio server /data --console-address ":9001"
-
Build the project with Maven:
mvn clean install
-
Run the Spring Boot application:
mvn spring-boot:run
Once the application is launched, you can start using the APIs.
-
Running with Docker:
To run the application with Docker, you can use the
docker-compose.ymlfile located in the root directory of the project:docker-compose up --build
Swagger URL:
http://localhost:8080/swagger-ui/index.html#/v3/api-docsGET /download/{filename}: Downloads file by file nameGET /download/{id}: Downloads file by ID
POST /upload: Upload fileGET /upload/all: List all File Metadata
POST /{packageName}/{version}: Deploy file with package name and version
GET /files: Get all metadata filesGET /files/{id}: Get file with specific IDPOST /files/upload: Save new fileDELETE /files/{id}: Delete file
-
If PostgreSQL connection is not available, check the Docker PostgreSQL container.
-
You can access the MinIO interface via http://localhost:9001 with minio/minio123.
-
If you are running it for the first time, you should create a bucket named repsy on MinIO.