Photoz Clone is a simple Spring Boot REST API for uploading, retrieving, and deleting photos. It uses an H2 in-memory database for storage and follows a layered architecture with models, repositories, services, and controllers.
- Upload photos via a REST API
- Retrieve all uploaded photos
- Retrieve a photo by ID
- Download photos
- Delete photos
- Spring Boot 3.3.0
- Spring Web (for REST API)
- Spring Data JDBC (for database access)
- Spring Boot Validation
- H2 Database (for in-memory storage)
- Maven (for dependency management)
photoz-clone/
│── src/
│ ├── main/java/com/ezahema/photoz/clone/
│ │ ├── model/ # Entity classes
│ │ ├── repository/ # Data access layer
│ │ ├── service/ # Business logic layer
│ │ ├── web/ # REST controllers
│ │ ├── PhotozCloneApplication.java # Main application entry point
│ ├── test/java/com/ezahema/photoz/clone/ # Test cases
│── pom.xml # Maven configuration
│── .gitignore # Git ignore rules
│── README.md # Project documentation
POST /photoz
multipart/form-data
- Parameter:
data
(file)
{
"id": 1,
"fileName": "example.jpg",
"contentType": "image/jpeg"
}
GET /photoz
[
{
"id": 1,
"fileName": "example.jpg",
"contentType": "image/jpeg"
}
]
GET /photoz/{id}
{
"id": 1,
"fileName": "example.jpg",
"contentType": "image/jpeg"
}
GET /download/{id}
- Returns the file as an attachment.
DELETE /photoz/{id}
204 No Content
- Java 17+
- Maven
- Clone the repository:
git clone https://github.com/your-repo/photoz-clone.git cd photoz-clone
- Build and run the application:
mvn spring-boot:run
- Access the API at
http://localhost:8080/
- Add user authentication
- Support for external databases (MySQL, PostgreSQL)
- Frontend UI for photo management
This project is open-source and available under the MIT License.