Java & Spring for modern containerized microservices in the backend
If you start to think about building modern middleware there are a lot of decisions that you need to take from the first moment.
Starting from the architecture if you feel that you need to go with microservices to be ready for containerization / clouds / horizontal scaling then you immediately wonder how to organize communication or manage transactions in such distributed environment or what kind of API expose (Restful / GraphQL / gRPC) and how to protect it.
The next important decision is a technology stack to use which will allow you to focus maximally on the business domain and not on implementing repetitive elements required from modern platforms.
In TWG we like to build backends based on Java & Spring with Full Reactive Stack including:
Additional in such distributed setup we are usually introducing:
- Distributed, correlated logs and tracing – Micrometer Tracing (former Spring-Sleuth), combined with Zipkin or Jaeger.
- Integration with many different logging systems: LOKI, AWS Cloud Watch, ELK Stack.
- Metrics exposure and monitoring, prometheus
• for basic statistics (uptime, start time, JVM statistics – memory, JVM statistics – GC)
• for REST API (inbound / outbound HTTP requests)
• for Spring data repositories (MongoDB) & mongoDB driver commands
Consumed by: Prometheus, Victoria Metrics or Datadog
Grafana as visualization and analytics solution
- Sophisticated security supporting oAuth2 / OpenID Connect often combined with keycloak as oAuth server (to not build by our own AAA and user management and use proven, easily extendable solution in java which is additional benefit as complete backend can be Done in a single language)
- Support for event driven systems / Spring AMQP and Spring for Apache Kafka
- Support for externalized configuration with Spring Cloud config and different backends as configuration storage (git, vault etc)
- Support for GraphQL as yet another presentation layer
- API Gateways, to expose solid API and hide internal distributed infrastructure, with standard gateways capabilities like: rate limiting, circuit breaker etc, based on spring components or kubernetes ingress controllers like Traefik
- Automatic REST API documentation generation in OpenAPI Standard – Swagger Specification successor openapis.org, springdoc.org
- Easy containerization thanks intelligent spring-boot concept and big players involvements, providing hardened base images like Amazon Corretto
- Production-grade, scalable and reliable distributed platforms build in a very fast way
- Happy developers doing great things 🙂
Have you already practiced a similar approach?