A web app for a photographer to make photos accesible to users online. Users can view their galleries. Admin can create Users, create Galleries for Users (only one per User) and upload photos to existing Galleries.
| dependency | version |
|---|---|
| java | 17 |
| spring framework | 4.0.0 |
| MySQL | latest compatible (9.5.0) |
| dependency management | 1.1.7 |
| docker compose | 3.8 |
LOGIN PAGE:
1 ST ACCOUNT:
2ND ACCOUNT:
ADMIN:
MANAGE USERS:
MANAGE GALLERIES:

- creating a docker container + docker compose yml for mysql and connecting with the database in the app
- making a simplified diagram how the app relationships would look like for reference
- creating all basic empty classes and interfaces such as: models, services, repositories, controllers and database
- making a data loading class to make the database have some users etc.
- setting up spring security that makes it available for the users in the database to log in
- creating APIs + testing them in POSTMAN to see how they look
- user: setting up the gallery page for existing users
- admin: creation of users + creation of galleries for existing users
- admin: adding photos to existing gallery
- adding css and fonts
- better documentation with features, screenshots :]
Clone the project
git clone https://github.com/nicoxeye/PhotoGalleryChange to your own passwords
# docker-compose.yml file
MYSQL_ROOT_PASSWORD: "EXAMPLE" # application.properties file
spring.datasource.password=EXAMPLEUse Docker compose
docker compose up -dRun the project ^^
[CHANGE spring.jpa.hibernate.ddl-auto=create-drop TO 'update' IF YOU DON'T WANT THE DATABASE TO REFRESH EACH TIME THE APP RESTARTS AND DELETE LoadData CLASS]
Login: JaneAusten
Password: 1234
Role: USER
Login: AnneRice
Password: 1234
Role: USER
Login: admin
Password: 999
Role: ADMIN
for spring security:
https://www.youtube.com/watch?v=nhsdPVXhbHo
https://www.youtube.com/watch?v=RhIXP5tjHkk
for fetching data using thymeleaf:
https://www.youtube.com/watch?v=TLtksmnrSII
for photo upload:
https://www.baeldung.com/spring-boot-thymeleaf-image-upload
└── src/
├── main/java/com/photogallery/
│ ├── apicontroller/ → api rest controllers, not really used anywhere, i did them to test requests in postman to see how data in json looked like for reference
│ │ ├── GalleryController.java
│ │ ├── PhotoController.java
│ │ └── UserController.java
│ ├── config/ → spring security configuration for logging in + user authentication
│ │ └── WebSecurityConfig.java
│ ├── controller/ → main controller, redirects pages between each other and also sends data to thymeleaf that pages retrieve
│ │ └── PageController.java
│ ├── database/ → i did a create-drop table from the start to avoid littering the database when doing testing so i decided to load some example data each time
│ │ └── LoadData.java
│ ├── model/ → database entities + role enum
│ │ ├── Gallery.java
│ │ ├── Photo.java
│ │ ├── Role.java
│ │ └── User.java
│ ├── PhotoGalleryApplication.java
│ ├── repository/ → model repositories extend jpa repositories that provides all the basic methods for handling data
│ │ ├── GalleryRepository.java
│ │ ├── PhotoRepository.java
│ │ └── UserRepository.java
│ └── service/ → holds business logic, interacts with repositories with additional data checking logic
│ │ ├── CustomUserDetailService.java
│ │ ├── GalleryService.java
│ │ ├── GalleryServiceImpl.java
│ │ ├── PhotoService.java
│ │ ├── PhotoServiceImpl.java
│ │ ├── UserService.java
│ │ └── UserServiceImpl.java
└── resources/
│ ├── application.properties
│ ├── static/
│ └── templates/
│ ├── admin/ → admin related pages, those with user role do not have access to them
│ │ ├── admin_creategallery.html
│ │ ├── admin_createuser.html
│ │ ├── admin_galleries.html
│ │ ├── admin_index.html
│ │ └── admin_users.html
│ ├── index.html
│ ├── login.html
│ └── user_gallery.html
└── uploads/ → photos to use while loading user photos in gallery from database, in reality would be somewhere else (on a server/disk)
└── trees.jpg