Illystre/Photo-Editor-
0 forks
A full-stack photo editing application built with React, TypeScript, Spring Boot, and Docker. Features include image upload, real-time editing with canvas manipulation, server-side transform pipelines, async job processing, and secure JWT authentication.
id: 15
7,695 Lines
- Markdown 42.8%
- Java 27.4%
- TypeScript-JSX 11.5%
- JSON 4.5%
- TypeScript 3.7%
- Yaml 2.9%
- XML 2.5%
- Python 2.5%
- SQL 0.9%
- CSS 0.6%
- Shell 0.4%
- JavaScript 0.2%
- HTML 0.2%
PhotoEditor - Professional Photo Editing Platform
A full-stack photo editing application built with React, TypeScript, Spring Boot, and Docker. Features include image upload, real-time editing with canvas manipulation, server-side transform pipelines, async job processing, and secure JWT authentication.
๐ Features
Core Functionality
- โ Image Upload & Management - Upload, view, and delete images
- โ Real-time Editing - Browser-based photo editing with Fabric.js
- โ Transform Pipeline - Server-side reproducible image transformations
- โ Undo/Redo - Full editing history with state management
- โ Filters & Adjustments - Grayscale, Sepia, Brightness, Rotation, Flip
- โ JWT Authentication - Secure user authentication and authorization
- โ Thumbnail Generation - Automatic thumbnail creation on upload
- โ Job System - Async background job processing with Redis
Technical Highlights
- Frontend: React 18 + TypeScript + Vite + Tailwind CSS + Fabric.js
- Backend: Spring Boot 3.2 + Java 17 + PostgreSQL + MinIO (S3)
- State Management: Zustand for lightweight, performant state
- Storage: MinIO for object storage, PostgreSQL for metadata
- Queue: Redis for job queue and caching
- Containerization: Full Docker Compose setup for local development
- API Documentation: OpenAPI/Swagger at
/swagger-ui.html
๐ Prerequisites
- Docker and Docker Compose (recommended)
- Java 17+ (for local backend development)
- Node.js 20+ (for local frontend development)
- Maven 3.9+ (for building backend)
๐ Quick Start
Option 1: Docker Compose (Recommended)
- Clone the repository
git clone <repository-url>
cd phoEditor
- Start all services
docker compose up --build
This will start:
- Frontend at http://localhost:5173
- Backend at http://localhost:8080
- PostgreSQL at localhost:5432
- MinIO at http://localhost:9000 (Console: http://localhost:9001)
- Redis at localhost:6379
- Access the application
- Open http://localhost:5173
- Create an account and start editing!
Option 2: Local Development
Backend Setup
- Start dependencies
# Start PostgreSQL, MinIO, and Redis
docker compose up postgres minio redis -d
- Run the backend
cd backend
./mvnw spring-boot:run
Backend will be available at http://localhost:8080
Frontend Setup
- Install dependencies
cd frontend
npm install
- Start development server
npm run dev
Frontend will be available at http://localhost:5173
๐ Project Structure
phoEditor/
โโโ backend/ # Spring Boot backend
โ โโโ src/main/java/
โ โ โโโ com/photoeditor/
โ โ โโโ config/ # Configuration (Security, MinIO, OpenAPI)
โ โ โโโ controller/ # REST controllers
โ โ โโโ dto/ # Data transfer objects
โ โ โโโ entity/ # JPA entities
โ โ โโโ enums/ # Enums (JobType, JobStatus)
โ โ โโโ exception/ # Exception handlers
โ โ โโโ repository/ # JPA repositories
โ โ โโโ security/ # JWT & security implementations
โ โ โโโ service/ # Business logic
โ โโโ src/main/resources/
โ โ โโโ db/migration/ # Flyway migrations
โ โ โโโ application.yml # Application configuration
โ โโโ pom.xml
โ
โโโ frontend/ # React frontend
โ โโโ src/
โ โ โโโ components/ # Reusable components
โ โ โโโ lib/ # API client & utilities
โ โ โโโ pages/ # Page components
โ โ โโโ store/ # Zustand state management
โ โ โโโ App.tsx # Main app component
โ โ โโโ main.tsx # Entry point
โ โโโ package.json
โ โโโ vite.config.ts
โ
โโโ docker-compose.yml # Docker orchestration
๐ง Configuration
Environment Variables
Backend
DB_HOST=postgres
DB_PORT=5432
DB_NAME=photoeditor
DB_USER=postgres
DB_PASSWORD=postgres
MINIO_ENDPOINT=http://minio:9000
MINIO_ACCESS_KEY=minioadmin
MINIO_SECRET_KEY=minioadmin
REDIS_HOST=redis
JWT_SECRET=your-secret-key-here
Frontend
VITE_API_URL=http://localhost:8080
๐ API Documentation
Once the backend is running, access the interactive API documentation:
- Swagger UI: http://localhost:8080/swagger-ui.html
- OpenAPI Spec: http://localhost:8080/v3/api-docs
Key Endpoints
Authentication
POST /api/v1/auth/register- Register new userPOST /api/v1/auth/login- Login user
Images
POST /api/v1/images- Upload imageGET /api/v1/images- Get all user imagesGET /api/v1/images/{id}- Get image metadataDELETE /api/v1/images/{id}- Delete imagePOST /api/v1/images/{id}/transform- Apply transform pipeline
Jobs
POST /api/v1/jobs- Create background jobGET /api/v1/jobs/{id}- Get job statusGET /api/v1/jobs- Get all user jobs
๐จ Editor Features
Transform Operations
- Rotate - Rotate image by 90ยฐ increments
- Flip - Horizontal and vertical flipping
- Brightness - Adjust image brightness
- Filters - Grayscale, Sepia, Invert
Canvas Features
- Pan & Zoom - Navigate large images
- Undo/Redo - Full editing history
- Real-time Preview - See changes instantly
- Export - Download edited images
๐งช Testing
Backend Tests
cd backend
./mvnw test
Frontend Tests (when configured)
cd frontend
npm test
๐ Security Features
- JWT Authentication - Secure token-based auth
- Password Hashing - BCrypt password encryption
- CORS Configuration - Controlled cross-origin requests
- Input Validation - Request validation with Bean Validation
- Presigned URLs - Secure temporary access to S3 objects
- Role-based Access - User role management
๐ Database Schema
Users
id(UUID),email,password_hash,roles,enabled, timestamps
Images
id(UUID),user_id,storage_path,thumbnail_path,width,height,mime_type,size,checksum, timestamps
Projects
id(UUID),user_id,name,project_json,thumbnail_path, timestamps
Jobs
id(UUID),user_id,type,status,input_image_id,output_path,parameters,logs, timestamps
๐ข Deployment
Building for Production
Backend
cd backend
./mvnw clean package -DskipTests
docker build -t photoeditor-backend .
Frontend
cd frontend
npm run build
docker build -t photoeditor-frontend .
Production Considerations
- Change JWT Secret - Use a strong, unique secret in production
- Database Backups - Configure automated PostgreSQL backups
- MinIO/S3 - Use AWS S3 in production for scalability
- HTTPS - Enable SSL/TLS for secure communication
- Resource Limits - Set appropriate memory/CPU limits
- Monitoring - Use Actuator endpoints with Prometheus/Grafana
- Logging - Configure centralized logging (ELK stack)
๐ฎ Future Enhancements
Planned Features
- ML Background Removal - Python FastAPI service with U-2-Net
- Super Resolution - AI-powered image upscaling
- Batch Processing - Process multiple images
- Collaborative Editing - WebSocket-based real-time collaboration
- Image Versioning - Track edit history server-side
- Advanced Filters - More professional filters
- Layer System - Multiple layers support
- Text Overlays - Add and customize text
- Export Formats - Support more output formats
๐ค Contributing
Contributions are welcome! Please follow these steps:
- Fork the repository
- Create a feature branch (
git checkout -b feature/amazing-feature) - Commit your changes (
git commit -m 'Add amazing feature') - Push to the branch (
git push origin feature/amazing-feature) - Open a Pull Request
๐ License
This project is licensed under the MIT License.
๐ Acknowledgments
- Spring Boot - Backend framework
- React - Frontend library
- Fabric.js - Canvas manipulation
- MinIO - S3-compatible object storage
- Thumbnailator - Image processing library
- Zustand - State management
๐ Support
For issues and questions:
- Open an issue on GitHub
- Check the API documentation
- Review the code comments
Built with โค๏ธ using modern web technologies