{"id":19766200,"url":"https://github.com/akaliutau/reactive-microservice","last_synced_at":"2026-04-10T02:15:04.668Z","repository":{"id":120056237,"uuid":"338323635","full_name":"akaliutau/reactive-microservice","owner":"akaliutau","description":"An example of reactive microservice built on the basis of Spring Boot, WebFlux and reactive database","archived":false,"fork":false,"pushed_at":"2024-01-24T13:01:13.000Z","size":33,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-01-11T00:13:26.105Z","etag":null,"topics":["docker","microservice","netty","reactive-programming","security","spring-boot","spring-webflux","streams"],"latest_commit_sha":null,"homepage":"","language":"Java","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/akaliutau.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null}},"created_at":"2021-02-12T13:14:06.000Z","updated_at":"2024-01-24T13:01:18.000Z","dependencies_parsed_at":"2024-01-24T14:28:04.329Z","dependency_job_id":"f2f0b180-30e3-4d15-8a09-8503c023266e","html_url":"https://github.com/akaliutau/reactive-microservice","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/akaliutau%2Freactive-microservice","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/akaliutau%2Freactive-microservice/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/akaliutau%2Freactive-microservice/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/akaliutau%2Freactive-microservice/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/akaliutau","download_url":"https://codeload.github.com/akaliutau/reactive-microservice/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":241099607,"owners_count":19909577,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["docker","microservice","netty","reactive-programming","security","spring-boot","spring-webflux","streams"],"created_at":"2024-11-12T04:23:02.307Z","updated_at":"2025-12-31T01:13:49.887Z","avatar_url":"https://github.com/akaliutau.png","language":"Java","funding_links":[],"categories":[],"sub_categories":[],"readme":"﻿\n![Generic badge](https://img.shields.io/badge/Build-passing-green.svg)\n![Generic badge](https://img.shields.io/badge/Language-Java-blue.svg)\n\n# About\n\nResource service is a simple microservice with purpose to provide a rudimentary CRUD API to PERSON database, which is used to hold the following data in each record:\n\n```\n   \"id\": Long, \n   \"first_name\": String, \n   \"last_name\": String, \n   \"age\": Integer,\n   \"favourite_color\": String\n```\n\n\nMain features:\n\n - built on the basis of Spring Boot 2.4.x with extensive use of Reactive Programming patterns (in this project I am using Spring WebFlux)\n\n - a persistence layer is built on Reactive H2 In-Memory database  \n\n - contains fine grade access security on the basis of Spring Security\n\nHere are the reasons behind my choice of technologies:\n\nSpring WebFlux is a reactive web framework based on a reactive HTTP layer; such apps can be deployed on Netty or Undertow \n(with native adapters) or Jetty/Tomcat/any Servlet 3.1 (In this implementation I am using Netty). \nReactive approach can be beneficial for efficiency and scalability for workloads dealing with lots of latency and concurrency. \nIn other words reactive approach allows to create responsive, resilient, elastic and message-driven systems. \n\nSpring's reactive concepts have been taken as is from Java 8's Reactor Core library, which implements the reactive programming paradigm. \nReactor Core in its turn is built on top of Reactive Streams Specification, which is the industry standard for building \nreactive applications in the Java world. \nFinally, all these technologies have been refined and collected under the hood of Spring WebFlux.\n\nSpring WebFlux is an ideal choice if application deals with streams of data (input and output), and is a part of some \nbigger system where reliability and performance of each component matters (being asynchronous system can deal with latencies and be more scalable)\n\nAs for security, fine-grained authorization from Spring Security's modules allows to secure the business tier through \nmethod annotation and the use of interface-based proxies to accomplish AOP. For demonstration purposes \nI added default user with username=user and password=123 which has two roles – `DB_USER` and `DB_ADMIN`\n\nIn real production system makes sense to use industry-standard oauth2 authorization flow, and implement centralized \nauthorization through separate oauth2 servers (f.e. those on the basis OpenID Connect and OAuth 2.0 API)\n\n# API overview\n\nBack-end has two different end-points, `` /api/persons`` and  ``/api/persons/{personId}``\nCurrently five methods are supported with the following signature:\n\n| Verb   | Endpoint                |\n|--------|-------------------------|\n| GET    | /api/persons            |\n| GET    | /api/persons/{personId} |\n| POST   | /api/persons            |\n| PUT    | /api/persons            |\n| DELETE | /api/persons/{personId} |\n\n\nFull API Documentation for back-end server's API is available on http://localhost:9090/api/documentation/swagger-ui/ \n\nSwagger UI works in the latest versions of Chrome, Safari, Firefox, and Edge.\n\n\n\u003cbr/\u003e\n\n\n# Installation\n\n## Dockerized build (needs docker to be installed first)\n\n1) The following command builds image with tag resource-service:1.0. Note the dot at the end of the command. This command must be run from the root directory.\n\n```shell\nsudo docker build -t resource-service:1.0 .\n```\n\n2) The next command instantiates and expose service at localhost:9090:\n\n```shell\nsudo docker run -p 9090:9090 resource-service:1.0\n```\n\n\n## Local build\nIn order to build and run both back-end the following prerequisites are needed:\n\n[JDK 11](https://openjdk.java.net/)\n\n[Lombok](https://projectlombok.org/download)\n\nRun from the project's root directory:\n```shell\nmvn clean package \n```\n\n\n\u003cbr/\u003e\n\nRun server as follows:\n\n```shell\njava -jar resource-1.0.0-SNAPSHOT.jar\n```\n\nServer will start on localhost:9090 address. One can point browser to http://localhost:9090/api/documentation/swagger-ui/ to see API documentation\n\nOn first request server will ask to authorize: use the following username/password pair:\n\nUsername: user\n\nPassword: 123\n\n# Testing\n\nThere are several integration tests written for web and business layers. I used the most popular testing frameworks \nin the Java ecosystem - JUnit 5 and Mockito, plus out-of-the-box functionality proposed by Spring Boot.\n\nOne can test endpoints manually, fe. using curl:\n\n```shell\ncurl -X GET \"http://localhost:9090/api/persons\" --user user:123 -H \"accept: */*\"\n```\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fakaliutau%2Freactive-microservice","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fakaliutau%2Freactive-microservice","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fakaliutau%2Freactive-microservice/lists"}