java-explore-with-me
Educational Project from Yandex Practicum Java Developer course.
public - available to any user without registration private - available only to registered and authorized users admin - available only to the admins of the service Note
The project doesn't handle any cross-cutting concerns like: user registration, authentication and authorization. It is assumed, that all requests come from a gateway service, which is responsible for registering, authorizing and authenticating a user as well as routing requests. Therefore the API is divided logically by endpoint names.
- Java
- Spring Boot
- Lombok
- PostgreSQL
- Docker
- Hibernate
- Spring Data JPA
- ewm-service
- stats-server
Contains all the business logic necessary for the app functionality.
The service is split into logically divided packages:
- Categories
- Compilations
- Events
- Locations
- Requests
- UserManagement
Each package has its own functionality.
It has public and admin endpoints:
- public provides functionality to:
- get all categories by pages
- get a category by its ID
- admin provides functionality to:
- create a new category
- delete a category
- update a category
It has public and admin endpoints:
- public provides functionality to:
- get all compilations by filters:
- pinned
- from
- size
- get a compilation by its ID
- get all compilations by filters:
- admin provides functionality to:
- create a compilation
- delete a compilation
- update a compilation
It has public, private and admin endpoints:
- public provides functionality to:
- get events by location ID
- get events by location coordinates
- get all events
- get event by id
Each request saves statistics to the statistics server. Requests that retrieve potentially large amount of data have filters:
- text that must be either in title or description of the event (optional)
- list of categories the event belongs to (optional)
- whether the event is paid or not (optional)
- start date of the event (optional)
- end date of the event (optional)
- only available for visiting (i.e. the event has not reached its participant limit) default value is false
- sort (optional):
- event date
- event views
- page start (default value 0)
- page size (default value 10)
- admin provides functionality to:
- search for events
- update events (decline or accept the event)
- private provides functionality to:
- get all events added by current user
- uses offset based paging
- add event
- get detailed info about an event added by current user by the event ID
- update the event added by current user
- get info about requests to participate in the event by other users
- accept or decline participation requests by other users
- get all events added by current user
It has only private part that provides functionality to:
- get all participation requests of a user by the user ID
- create a request to take part in an event
- cancel a request to take part n an event
It has only admin part that provides functionality to:
- get all users
- uses offset-based paging
- create a user
- delete a user
- Collects statistics about user interactions with public endpoints:
- when user views a listing with events
- when user views detailed information about an event
- Provides endpoint to get statistics for a list of endpoints
Communication is performed via REST API by means of Spring's RestTemplate. That is the communication is synchronous.
API of both services is described using OpenAPI.
https://github.com/Kir-Mi/java-explore-with-me/blob/main/ewm-stats-service-spec.json
https://github.com/Kir-Mi/java-explore-with-me/blob/main/ewm-main-service-spec.json
First run:
mvn clean package
Then run:
docker-compose up -d
This command will create 4 docker containers:
- stats-server
- stats-db (postgres:14-alpine) running on port 5432, DB name: stats, user: postgres, password: postgres
- ewm-service
- ewm-db (postgres:14-alpine) running on port 5431, DB name: ewm, user: postgres, password: postgres
After successfully starting the project you can import Postman collections from folder /postman and run them one-by-one independently of each other.