Java Spring Boot backend API of online system for searching therapists and booking their services
It also provides reviews system and user experince personalization (profile settings and favorites list)
This is the Backend part of a team project at Mate Academy
- Client part of the project (React)
- FigmaJam development board (link to UI assets in the end of document)
"Project MindBloom" provides different operations:
- Role-based access/authorization (Admin, Customer)
- User management: Allows to see/edit data about user profile
- Pshychologists management: Allows to find/create/remove/edit data about psychologists
- Review management: Allows to see/create/remove reviews for pshychologists
- Booking management: Allows to find/create/remove/edit data about bookings of avaliable psychologists meetings
- Payment management: Allows to see/create/confirm/cancel/renew payments with support of Stripe payment system
- Email notifications: Provides meassages with interactive link to support user workflow in system
Core:
| Tool | Description |
|---|---|
| Java 17 | Core programming language of the backend |
| Maven | Project management and build tool |
Spring:
| Tool | Description |
|---|---|
| Spring Boot 3.4.2 | Advanced architecture framework for building applications |
| Spring Boot Web | Enables embedded web server and REST API development |
| Spring Data JPA | Simplifies database access operations using JPA and ORM |
| Spring Boot Security | Provides authentication and authorization capabilities |
| Spring Boot Validation | Ready-to-use collection of data constraints/checks |
| Spting Boot Mail | Library to integrate mail sending |
Data storage and access:
| Tool | Description |
|---|---|
| MySQL 8.0.33 | Database management system |
| Hibernate | Bidirectional mapping tool between Java code and SQL database |
| Liquibase | Tool for database creation and version control |
External functional API:
| Tool | Description |
|---|---|
| Stripe API | Library to integrate Stripe payment functions to API project |
| Gmail API | Toolking to manage mail sending via SMTP protocol |
Additional libs and tools:
| Tool | Description |
|---|---|
| Lombok | Library for Java code simplification |
| MapStruct | Tool for simple data mapping |
| JWT | Authorization standard |
| Swagger | Tools to create API documentation |
| Redis (Lettuce) | Caching of paginated data for quick access |
Deployment:
| Tool | Description |
|---|---|
| Docker | Platform for project packaging and deployment |
| Namecheap | Source of domain with SSL certificate (Nginx on EC2 VM) |
| AWS | Platform to deploy Java project, Database and Redis |
| AWS S3 | Contains images of user profiles and psychologist pages |
| AWS EC2 | Virtual machine to run composed docker image of project |
| AWS RDS | Database service for deployed project |
| AWS ECR | Docker contatiner registry to receive images for EC2 |
| AWS Route 53 | Connects EC2 IP to domain |
- Download Java and Maven.
- Open your terminal (cmd) and check Java installation by
java -versionand Mavenmvn -version - Clone repository: Open your terminal (cmd) and use
https://github.com/MishaHMK/PsychologistAppApi.git. - Download and install MySQL.
- Open your terminal (cmd) and create MySQL user
mysql -u USER -p. - Create a database
CREATE DATABASE DB_NAME; - In src/main/recources/application.properties put proper MySQL db data:
) - Check if all data in .env file is put and resources files in src/main and src/java are filled
- Register Stripe account and visit Dashboard to receive API Keys (Secret Key)
- Create image storage like Imgur or S3 which can access your images by URL
- Prepare SMTP Google account and keys (if you need Mail Sending functions)
- Download and install Docker if you won't use Docker
put
spring.docker.compose.enabled=falseand comment (via # symbol) fieldsspring.data.redis.hostandspring.data.redis.hostin src/main/resources/application.properties - Open terminal (cmd) in root folder and do
docker-compose buildanddocker-compose up - Run project
mvn clean installand thenjava -jar target/PsychologistApp-0.0.1-SNAPSHOT.jar - Proceed to Interactive Swagger Documentation
🔸 Backend endpoints are testable in deployed Documentation 🔸 Full project with UI Client is testable here
Some endpoints require a [role] for access, use JWT token (Bearer) or Basic authentication.
Enpoints with pagination store data in Redis cache storage for faster access of previously received data. Cache automatically updates after performing operations, which can change state of this data.
Register, Booking and Payment operations are supported by email with interactive links.
AuthController: Handles registration and login requests.
- POST:
/api/auth/registration- register new user. - POST:
/api/auth/login- login user and receive JWT token.
UserController: Handles registration and login requests.
- PUT:
/api/users/update- update currently logged in user profile data [Admin]. - PATCH:
/api/users/update-image- update role of the selected user by his id. - GET:
/api/users/me- receive currently logged in user info. - DELETE:
/api/users/remove-user- remove currently logged user profile from db.
PsychologistController: Handles requests for psychologist operations (Authorization can be required).
- GET:
/api/psychologists- Receive all psychologists (pagination). - GET:
/api/psychologists?/{id}- Receive a specific psychologist data by ID. - GET:
/api/psychologists/liked- Receive all psychologists, liked by current user. - GET:
/api/psychologists/filtered- Receive all psychologist data filtered by specific criterias. - PATCH:
/api/psychologists/like/{id}- Like a specific psychologist by ID for current user. - POST:
/api/psychologists- Create a new psychologist. [Admin] - DELETE:
/api/psychologists/{id}- Soft delete psychologist. [Admin]
ReviewController: Handles requests for psychologists reviews from users.
- GET:
/api/reviews/all/{psychologistsId}- Receive all reviews for psychologist by id. - GET:
/api/reviews/review-page/{psychologistsId}- Receive all latest (sorted/limit 6) reviews for psychologist by id. - GET:
/api/reviews/{reviewId}- Get review data bt ID. - POST:
/api/reviews- Create new review. - DELETE:
/api/reviews/{reviewId}- Delete review by ID. [Admin]
BookingController: Handles requests for bookings operations (Authorization is required).
🔸 Allowed booking type values are: PENDING, CONFIRMED, CANCELED, EXPIRED.
🔸 Allowed booking times are: 9AM - 17PM (:00 minutes)
- GET:
/api/bookings- Receive all bookings in system. [Admin] - GET:
/api/bookings/my- Receive all bookings of current user. - GET:
/api/bookings/{id}- Search a specific booking by ID. [Admin/Customer owner] - GET:
/api/bookings/lockedDates/{psychologistId}- Receive all locked dates for psychologist by ID. - GET:
/api/bookings/free_spots/{psychologistId}- Receive all free spots for psychologist by ID and date. - POST:
/api/bookings- Create new booking. - POST:
/api/bookings/unauthorized- Create new booking without authorization. - PATCH:
/api/bookings/update-status/{id}- Change booking status. [Admin] - DELETE:
/api/bookings/{id}- Soft delete booking. [Admin]
PaymentController: Handles requests for payment operations.
🔸 Allowed payment type values are: PENDING, PAID, CANCELED, EXPIRED
- GET:
/api/payments- Receive all user payments. - GET:
/api/payments/success- Receive payment confirmation (redirection). - GET:
/api/payments/cancel- Receive payment cancellation (redirection). - GET:
/api/payments/user/{userId}- Receive user payments [Admin or CurrentUser]. - GET:
/api/payments/create- Proceed to payment creation from URL (used in mails). - POST:
/api/payments- Create new payment. - PATCH:
/api/payments/{id}- Renew expired payment. [Admin]