Skip to content

This is a simple REST API that exposes two endoints and provides info about characters from Rick&Morty universe. It uses an external API to synchronize data.

Notifications You must be signed in to change notification settings

PavloPolovyi/rick-and-morty

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

14 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Rick&Morty characters Wiki

📣 Project description 📣

This is a simple REST API that exposes two endoints: /random - to get info about random Rick&Morty characters and /by-name?nameLike={query} - to find info about characters whose name is like query pattern. The data is dynamically synchronized using an external API (https://rickandmortyapi.com/). This application follows SOLID principles and is built up using N-tier architecture.

Features

  • Dynamical data synchronization using built in Spring Boot feature

  • Saving data to the database

  • 3-layer architecture: Controllers, Services and Repositories

  • All endpoints are described using OpenAPI specification

  • Sending requests to external API

  • Using latest stable Java version and Spring Boot 3

  • Project includes tests for Repository, Service and Controller layers

🧱Project structure🧱

- Controllers - take main part in request/response cycle, receive data from users and invoke business logic of services to process it and store in database. Send back data to users, when they request it.
- Services - this layer coordinates work of all application, process commands and performs data sync.
- Repositories - here information is stored and retrieved.

Technologies

  • Java 17
  • Spring Boot
  • Spring Data JPA
  • Spring MVC
  • PostgreSQL
  • Hibernate
  • Docker
  • Liquibase
  • OpenAPI 3.0
  • JUnit, Mockito, Testcontainers, Spring Boot Testing
  • FeignClient for sending requests to external API

💣Instructions for launching the project💣

To run this project locally, follow these steps:

1️⃣ You should install Docker for easy launching

2️⃣ Clone this project from GitHub

https://github.com/PavloPolovyi/rick-and-morty

3️⃣ Navigate to project folder in terminal and run following command:

./mvnw clean package -DskipTests

if it has failed, install Maven and run following command:

mvn package -DskipTests

4️⃣ Then run and wait while images are building:

docker compose build

5️⃣ And finally run application. Start takes a while, because of initial data synchronization:

docker compose up

6️⃣ Go to the browser and use the following url to test the application and see OpenAPI documentation.

http://localhost:8081/swagger-ui.html

7️⃣ If port 8081 is busy on your machine, just change SPRING_LOCAL_PORT value in the .env file.

About

This is a simple REST API that exposes two endoints and provides info about characters from Rick&Morty universe. It uses an external API to synchronize data.

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published