# Tale Service

## Overview

_The project uses Java 17 and Spring Boot 3.1.5_.


## Architecture
The project is designed with 4 main components:

    .
    ├── application               # Controllers, passing user requests into services respectively
    ├── core                      # Domain logic, designed into services
    ├── infrastructure            # Config, repository, third parties,...
    └── shared                    # Constants, DTO, utils,...

And we have a main flow as shown below:

![Raw Design](src/main/resources/META-INF/raw_code_flow.png)

## Setup

To run this project (optional for new guys, **minimum 16GB RAM** if you want to run local **Elasticsearch**)

- Run `docker-compose up -d` to start **MySQL**, **MongoDB**, **Redis**, 
- Optionally you can uncomment and start **Kafka**, **ActiveMQ** and **Elasticsearch** (or update your database configs in **application.properties**)
  
    _Notes: **Elasticsearch** container requires much RAM on local_

- Run **_resources/schema/mysql-schema.ddl_** to initialize your MySQL database.
- Run commands in **_resources/schema/mongo-schema.ddl_** to initialize your MongoDB database.
- Run your **TaleApplication** and check Swagger UI: http://localhost:8080/swagger-ui/index.html#/

## Tools

#### Redis Commander (for Linux only)

- Install [Redis Commander](https://github.com/joeferner/redis-commander) as your Redis client
- Run `redis-commander --redis-db 10 --redis-password 123` (depends on your db/password config)
- Check your Redis Commander UI: http://127.0.0.1:8081

#### DataGrip

- I recommend using [DataGrip](https://www.jetbrains.com/datagrip/download/) to work with MySQL, MongoDB, Redis

## Project Template Source 

https://github.com/hieubz/spring-boot-template-project?tab=readme-ov-file