This is a sample Spring Boot REST API designed to simulate a minimalistic package repository system for the fictional Repsy programming language.
The purpose of this project is to simulate a minimal package management system for educational and demonstration purposes. It showcases:
- RESTful API design using Spring Boot
- Modular storage strategies
- Integration with PostgreSQL and MinIO
- Best practices in Java backend development
It is ideal for junior/mid-level backend developers to practice working with file uploads, storage abstractions, and monolithic-friendly design patterns.
- Java 17 (LTS)
- Spring Boot
- PostgreSQL
- MinIO (Object Storage)
- Docker
- Maven
src/main/java/com/example/repsy
├── config # Configuration classes for MinIO and storage strategy
├── controller # REST controller for package upload and download
├── dto # Data Transfer Objects
│ ├── request
│ └── response
├── entity # JPA entities (e.g., Package)
├── exception # Custom exceptions and global handler
├── repository # Spring Data repository
├── service # Business logic layer
│ ├── abstract
│ └── concrete
├── storage # Storage service implementations
│ ├── FileStorageService
│ ├── ObjectStorageService
│ └── StorageService (interface)
└── RepsyApplication # Spring Boot main entry
- Upload endpoint for
.reppackages andmeta.jsonfiles - Download endpoint for fetching uploaded files
- Two interchangeable storage strategies:
- Filesystem storage
- Object storage (e.g., MinIO)
- PostgreSQL database integration
- Dockerized Spring Boot application
- Modular architecture with reusable libraries
POST /{packageName}/{version}
Request Body:
multipart/form-datawith:package.rep(binary file)meta.json(application/json)
Only valid file types and structures are accepted. Invalid submissions are rejected.
{
"name": "mypackage",
"version": "1.0.0",
"author": "John Doe",
"dependencies": [
{ "package": "even", "version": "3.4.7" },
{ "package": "math", "version": "4.2.8" },
{ "package": "std", "version": "1.2.0" },
{ "package": "repsy", "version": "1.0.3" },
{ "package": "client", "version": "3.3.0" }
]
}GET /{packageName}/{version}/{fileName}
Returns the requested file if available in storage.
In application.properties:
storage.strategy=file-system # or object-storageThis can also be overridden using an environment variable:
STORAGE_STRATEGY=object-storage| Strategy | Description |
|---|---|
| file-system | Stores files on local disk |
| object-storage | Uses MinIO as backend |
Example .env file:
STORAGE_STRATEGY=object-storage
MINIO_URL=http://localhost:9000
POSTGRES_URL=jdbc:postgresql://localhost:5432/repsyBuild and run the app:
docker build -t repsy-api .
docker run -p 8080:8080 repsy-apiMake sure PostgreSQL and MinIO are running (or use Docker Compose).
- Java 17+
- Spring Boot
- PostgreSQL
- Docker
- MinIO
- Maven
- Public GitHub repository with proper Git history
- Libraries published to Repsy Maven repository
- Dockerized app published to Repsy Docker registry
Contributions are welcome! To contribute:
- Fork the repository
- Create a feature/bugfix branch
- Commit your changes
- Submit a Pull Request
This project is licensed under the MIT License.