Skip to content

Latest commit

 

History

History
98 lines (72 loc) · 1.89 KB

File metadata and controls

98 lines (72 loc) · 1.89 KB

MS-Foo

A reactive Spring Boot microservice built with Java 21, WebFlux, and R2DBC for PostgreSQL integration.

Features

  • Reactive Programming: Built with Spring WebFlux and R2DBC
  • Real-time Streaming: Server-Sent Events (SSE) for live data updates
  • Database Integration: PostgreSQL with Flyway migrations
  • CRUD Operations: Full REST API for Foo entities
  • Containerized: Docker Compose setup included

Tech Stack

  • Java 21
  • Spring Boot 3.5.5
  • Spring WebFlux
  • Spring Data R2DBC
  • PostgreSQL 16
  • Flyway
  • Docker

Quick Start

Prerequisites

  • Java 21+
  • Docker & Docker Compose
  • Maven 3.6+

Running the Application

  1. Start PostgreSQL:

    docker-compose up -d
  2. Run the application:

    ./mvnw spring-boot:run

The application will start on http://localhost:8080

API Endpoints

REST API

  • GET /foo - List all Foo entities
  • POST /foo - Create new Foo entity
  • DELETE /foo/{id} - Delete Foo entity

Streaming API

  • GET /foo/stream - Server-Sent Events stream of Foo updates

Database

PostgreSQL database runs on port 1111 with:

  • Database: foo
  • Username: postgres
  • Password: postgres

Flyway handles database migrations automatically on startup.

Development

Build

./mvnw clean package

Test

./mvnw test

Docker Build

docker build -t ms-foo .

Project Structure

src/
├── main/java/com/guilhermescherer/msfoo/
│   ├── controller/     # REST controllers
│   ├── dto/           # Data Transfer Objects
│   ├── model/         # Entity models
│   ├── repository/    # R2DBC repositories
│   └── service/       # Business logic
└── main/resources/
    ├── db/migration/  # Flyway migrations
    └── application.properties

License

This project is licensed under the MIT License.