Can I have an Express server and Java Spring boot for Backend at the same time? - spring-boot

I am using Java spring boot for an REST API, using Stripe to handle Payment. To handle the payments, I am planning to use an Express server. Is this Okay? Will I face any issues in deployment?
I am planning to start working on it soon.

This is really an architectural choice that you can take. It can be justified as being part of a micro-services architecture. This is not uncommon, to have different services being developed with different languages and infrastructures, especially when you have different teams with different skillsets working on isolated features/services. There are a couple of things to be careful about though:
Maintainability
Interoperability
Infrastructure
Security
etc.
I hope this gives you enough to think about to make your decision.

Related

What is Microservices and is there a connection with MVC

I'm familiar with spring boot framework and I developed an Application which helps to handle online Assignments.I used few service classes to handle different tasks of the application and its structure can be seen here.
And I have seen several complex applications built as independent packages based on the task it do in the application.
(1)
My First question is can my Application be called as a MicroServices Application?? Because I have
used independent services for the application development.
(2)
And my second question is Can a application developed in MicroServices Architecture has MVC Architecture at the same time.But I have seen in several tutorials they are 2 different architectures.But a Moicroservices Application also has Models ,Views and Controllers at the same time.
So can those 2 be used at the same time??
Thank you!!
You should do some deeper research yourself about the concept and theory of microservices. Studying other applications without the basic knowledge can be misleading.
(1) Just because you are using multiple classes called services does not mean, you are building microservices application. Microservice application examples can be - student management rest api, question and answer management rest api, UI for administration, UI for public usage etc. All of them can be separate spring boot apps, or any other technology capable of handling the requirements (node.js, python, php, Asp.net ...) You should be able to deploy, test and use them as separate standalone apps.
(2)I think a microservice app does not need views, it can be a rest/soap app, log aggregation app, health check app, messaging service app etc. But different types can use different architecture, one of which can be MVC.
By definition of M. Fowler microservices are
..an approach to developing a single application as a suite of small services, each running in its own process and communicating with lightweight mechanisms, often an HTTP resource API.
As you see the definition is ambiguous. I think you are building a monolith application with a good separation of responsibilities into classes called XyServices - a possible candidates to migrate to microservices.
Microservices according to Chris Richardson
( recognized thought leader in microservices) is Microservices - also known as the microservice architecture - is an architectural style that structures an application as a collection of services that are
Highly maintainable and testable
Loosely coupled
Independently deployable
Organized around business capabilities
Owned by a small team
The microservice architecture enables the rapid, frequent and reliable delivery of large, complex applications. It also enables an organization to evolve its technology stack.
It is way of delivery and based on 12 factors
https://12factor.net/.
We use domain driven design as one of the way.
MVC is way of designing as service where we have model view and controller.
In Microservices architecture we can use MVC in one way where each component will be distributed .
Please go through the Microservice Patterns. It is very good book to understand the Microservices architecture
1.Answer to your question yes your application can be Microservices if it followed the 12 factors as mentioned in the website .
Yes Microservices can be on the pattern of mvc but they will be distributed and like we have Microservices for backend in similar fashion we have micro frontend for UI .

What patterns could I implement in microservice development?

I'm going to begin a new project of microservice and want know about patterns that I might wan't to implement on my new microservice for that I could scale, don't have problems with load balance, have an good service with resilience.
I looking to know about patterns that might microservices should implement
Also could you provide some indications for Java microservices application?
For solve some problems that was said: [1]
Architecture: You could build small microservices as it can be, so that the scale be right focused on need to be.
You could set a Discovery service for registering the applications instances, with that making easier to the client access the right application when are lots of instances of the same service (Netflix Eureka / Spring Cloud).
You could set a Configuration outside the code source of the code, so that all the instances can be configured without human intervention right on the running code (Spring Cloud Config).
Set a way the check the health of the microservice with ease.
I circuit breaker for clear the anomalies microservices instances (Spring Cloud / Netflix Hystrix).
and following as say the Twelve-Factor App.
With lots of another things that you need to that care when building a microservice, suggesting the reading the book, if you'll use Java for building microservices Spring Microservices in Action By John Carnell , if you i'll implement in another programming language this other could guide you, Microservices in Action by Morgan Bruce and Paulo Pereira.
[1] (https://www.amazon.com.br/Spring-Microservices-Action-John-Carnell/dp/1617293989

Does Spring Boot needs to be run on AppServer like Weblogic?

I have used only Spring framework and deployed as spring boot application It just opens and runs as a java application , Why do a companies with only spring framework runs on app server they can run on JAVA application as usual ? why do they need App server? What all can an app server does ?
Application servers are usually designed to host multiple applications, and manage a set of services that are used by all these applications. These services might include transaction management, timers and task management, HTTP request routing, a message broker (for inter-process communication, among other things), user management, etc. There's usually a graphical or command-line management console, or both.
The Spring framework is usually used to build a single, mostly-self-contained application. Spring does provide common services like transaction management, although they typically require a deal more developer understanding than is the case with, say, a JEE appserver.
There are all sorts of application containers and frameworks, offering different kinds of services in different ways. Often there is no killer reason to pick one over the other, and they are to some extent interchangeable. Spring Boot seems to be rising in popularity right now, because (perhaps) of its better fit to the microservices-type development models that are currently popular.

Example open source microservices applications

I'm looking for open source applications that demonstrate the microservices pattern. In particular, I'd like to find one or more applications that can be spun up on real cloud environment up (but with fake data and requests) to demonstrate real-world deployment mechanics.
Unfortunately, I haven't found any good options yet. I'll note that Discourse is a modern 3-tier application, using Rails API, Ember.js, Postgres, and Redis, but it still is much closer to a monolith than an example of microservices. The closest I've found so far is https://github.com/kbastani/spring-cloud-microservice-example but that is more of a framework than an actual application that delivers data.
Not your typical CRUD app but Deis (a PaaS) uses REST APIs mostly to communicate between services. Peatio has a bunch of services that communicate asynchronously through a message queue.
Microsoft provides a demo webshop application based on .NET Core showing how to apply the microservices pattern:
https://github.com/dotnet-architecture/eShopOnContainers
There is also an ebook available: https://aka.ms/microservicesebook
this lagom application example is a microservices application written in Lagom . It is a akka based framework (DDD for design).
Application is complete and working. See if that serve your purpose.

what is Cloud Foundry & spring

I am trying to get the idea of cloud serves but didn't get the point of that.
Dose it can replace a server for the app?
what is the purpose of it?
I have an android app and I what to get info from the server can it be done with Cloud Foundry and what is spring and how it connects to Cloud Foundry.
If you can give me link of how to communicate android app with Cloud Foundry
thanks a lot!
CloudFoundry's an open-source PaaS (github.com/cloudfoundry). It commoditizes the stack - that is, in practical terms, it makes it dead simple to get things like databases (MySQL, PostgreSQL, Redis, MongoDB), messaging (RabbitMQ), and web servers (Tomcat) up and running quickly. Whereas clouds like AWS let you spin up CPUs and hard disks and a stock OS install, a PaaS like CloudFoundry lets you spin up infrastructure, like message brokers, databases, and web servers and routers. So, yes, it replaces a server (or, often more importantly, it can stand in for 1000 servers on-demand). That's the obvious part.
CloudFoundry itself is open source, so unlike other PaaS solutions, by building on top of CF you're not locked into CF. You can later decide to run the cloud locally on your own datacenter, or on some other CloudFoundry provider (CloudFoundry.com is just one provider of the CloudFoundry software. Just as you can easily re-target a git repisotry to have it point to any remote repository using the git command line tool, you can re-target the CloudFoundry 'vmc' command line tool to point to a different CloudFoundry install.
Spring's a development framework in Java. It's not the only way to consume CF, but I personally think it's quite nice. CF exposes a lot of different technologies for the eager technologist and Spring provides the only comprehensive library set that can handle all those options. Learn one Spring library and the others will feel simialar, and so it's more natural to get started with a new API and technology. In the way that APIs designed with idiomatic Python APIs are said to be "Pythonic," Spring's APIs are cohesive and work nicely together. However, if Java's not your cup of tea (punny!), then that's OK too. CloudFoundry supports Ruby on Rails, Scala, Node.js, and other cloudfoundry providers support alternatives (Stacato supports Python, AppFog supports PHP, etc.)
For a quick example demonstrating how to get started with Spring, and the SpringSource Tool Suite, and a development virtual machine for CloudFoundry (so you can develop locally and quickly), check out this blog (and, particularly, the video embedded therein): http://blog.springsource.com/2011/08/24/micro-cloud-foundry-for-spring-developers/
The Springsource team has been doing some interesting work this year integrating a variety of Spring projects with Cloud Foundry.
With the rising popularity of microservices, many of the Spring projects are proving to be useful not only for quickly developing these smaller, lighter weight services, but also for easily incorporating some of the projects from Netflix OSS that implement patterns for making them industrial strength even at web scale.
A few related links:
The latest Cloud Foundry Java buildpacks include support for Spring
Boot and Spring Auto-reconfig (https://github.com/cloudfoundry/java-buildpack/releases).
The CF docs
contain an example on deploying Spring Boot apps to Cloud Foundry or
Heroku
The new Spring Cloud project will "Integrate your application with Pivotal Cloudfoundry. Makes it easy to implement SSO and OAuth2 protected resources, and also to create a Cloudfoundry service broker."
I look forward to seeing more of the results from the collaboration between the Cloud Foundry and Spring teams. One evidence of this is a recent tweet from Pivotal's James Watters "As the Microservices trends take off its pretty amazing to have the world's leading lightwieght #springframework on same team as CF."

Resources