Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/vladovsiychuk/microservice-demo-java
Demo API service in Java with all necessary settings. Integrates PostgreSQL, MongoDB and Redis.
https://github.com/vladovsiychuk/microservice-demo-java
java microservice mongodb postgresql redis spring-boot
Last synced: 1 day ago
JSON representation
Demo API service in Java with all necessary settings. Integrates PostgreSQL, MongoDB and Redis.
- Host: GitHub
- URL: https://github.com/vladovsiychuk/microservice-demo-java
- Owner: vladovsiychuk
- Created: 2024-10-05T11:29:14.000Z (4 months ago)
- Default Branch: main
- Last Pushed: 2025-02-01T12:13:31.000Z (13 days ago)
- Last Synced: 2025-02-01T13:24:12.775Z (13 days ago)
- Topics: java, microservice, mongodb, postgresql, redis, spring-boot
- Language: Java
- Homepage:
- Size: 149 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
## Social Media API Service Demo
This project demonstrates a microservice architecture for a social media platform using Spring Boot. IIt has two main domains: **Post** and **Comment**, each managed as a separate domain. The project employs a CQRS pattern for efficient data retrieval and updating, with integration of PostgreSQL, MongoDB, and Redis.
### Key Features
**Domains**:
- Post Domain: Handles post creation, updates, and deletion.
- Comment Domain: Manages comments linked to posts.
- Each domain uses its own table in PostgreSQL to store the entities.
- CQRS (Command Query Responsibility Segregation):
- When an entity (post or comment) is saved or updated, an application event is triggered.
- This event is consumed by a backend-for-frontend (BFF) module, which updates the post aggregate in MongoDB.
- MongoDB stores the Post aggregate as a JSON object, making it available for fast data retrieval by the frontend.**MongoDB**:
- Stores the aggregate as JSON, allowing quick and efficient access to data for frontend clients.
- Updates the aggregate when new comments are added or posts are created.**Redis Cache**:
- Caches REST requests for the post aggregate, optimizing performance and reducing load on MongoDB.**Technology Stack**
- Spring Boot
- PostgreSQL
- MongoDB
- Redis
- CQRS Pattern**How it Works**
- When a post or comment is created or updated, it is saved to the relevant domain’s table in PostgreSQL.
- The domain triggers an application event.
- The backend-for-frontend (BFF) module listens for these events and updates the Post aggregate in MongoDB.
- The aggregate is used to provide fast data to the frontend.
- Redis caches REST requests for the aggregate, further improving performance.This project is a simple demonstration of using microservice architecture with CQRS, event-driven communication, caching, and multiple database technologies.