Microservices and Vaadin UIs

If you have been following the web development industry in the last years, there’s a good chance that you have at least heard about microservices architectures. Some would say microservices are a specialization of SOA, others that microservices are the same as SOA, or that microservices are SOA done right. In any case, you might be wondering how to take advantage of the knowledge around microservices. Is it a good architecture for your project? How can Vaadin help in microservices architectures?

In this article, I will talk about the role of Vaadin applications in microservices architectures and provide some guidelines to help you decide on when and how to use microservices with Vaadin.

What are microservices architectures?

Microservices architectures are about modularization. The key term in how modularization is done in microservices architectures is the process. Each service, or microservice, runs as a separate process that can be independently deployed. This makes it possible to use heterogenous technologies, to horizontally scale by starting additional instances, to replace parts of a system (a microservice), and to add resiliency mechanisms than run when a part of the system doesn’t work. This might sound like nothing new, but think of microservices architectures as a revamp of existing practices while reading this article.

Another aspect of microservices architectures is that they help in big projects. Amazon, Ebay, and Netflix are often cited as examples where microservices solved architectural problems. On the other hand, each microservice should be “small”. Defining what’s small and what’s not depends on each project, so ask yourself whether your project “feels” too big for your team. If the answer is yes, consider microservices. If the answer is no, don’t use microservices. In any case, you can benefit from the techniques frequently used in microservices architectures. Just remember not to fall into the “nanoservices” antipattern.

Where do UIs fit in the microservices model? It depends on the specific requirements. It might be that a single UI is the best approach to make your microservices available to people. This could mean that the UI is small enough to be developed by a small team of developers, for example. However, sometimes it makes sense to have separate UIs as separate microservices (deployed independently). For example, the system might serve to many business units with heterogeneous groups of users where each UI can be developed independently.

Single UI

This is probably the best scenario for most projects and Vaadin can easily fit in. Ideally, a UI is all about view logic without any business logic at all. If you can think of the UI as a tool for the data, then providing a single microservice that acts as a human front-end for your project is a good approach in a microservices architecture.

How does a Vaadin application communicate with other microservices? Because your Vaadin code is Java running on the server side, you can consume other microservices using any Java technology to connect to them. There are a few patterns or techniques that you should at least consider when consuming microservices from a single Vaadin UI.

First, use a service registration and discovery mechanism. This allows the clients of a service to locate services in environments where the exact location of a service might dynamically change. Usually, client microservices will consult a centralized registry for the location of a microservice.

Second, use an API gateway when a client needs to invoke calls to several microservices with probably different communication protocols. Not only might this reduce network traffic, but also reduce the complexity of the client code. However, if your microservices are running on the same network, the API gateway might not be necessary when using the same connection protocols among them. In this situation, a Vaadin UI probably has a strong and fast network connection to the microservices and caching can be done at the UI level (and it’s often done somewhat automatically, for example in Grid rows).

Could this become a big monolith? Maybe. Not all monoliths are bad, though. But, if you really think you’ll have to face the typical problems associated with big monoliths in your Vaadin UI, you can consider splitting it into several individual projects.

Multiple UIs

Some authors and developers advocate for creating one UI per microservice. Before going this way, carefully think if this would be beneficial for your project. Software architecture should not be a goal but a tool. To fully harness the benefits of a microservices architecture, each microservice should work independently. The ideal scenario when having multiple Vaadin microservices is that each one can be visualized independently, in different browser tabs, for example. There is no need to add special configurations in the case of Vaadin microservices with this approach.

But let’s say you’d like to have separate Vaadin microservices and aggregate them into a “mash-up”. You have three alternatives in this scenario: IFrames, Portlets and UIs embedded directly to a single host page.

The easiest way to integrate several web applications into a single one is by using HTML’s <iframe> tag. You can use Vaadin (BrowserFrame) or any other web technology to develop the mash-up. IFrames are not that bad, however keep in mind there might be some pitfalls.

A good alternative, if you want to go to the route of several Vaadin microservices integrated into a single UI, is Portlets. By using an enterprise portal framework you gain some extra features such as authentication, authorization, and portlets’ inter-communication. Depending on the vendor, it might be possible to fulfill the microservices definition we used in this article, particularly, regarding the ability of microservices to run in separate processes. If you are interested in using portlets, consult the documentation of portal providers regarding support for microservices architectures.

The last alternative is to create a mashup which embeds multiple external UIs hosted in different servers into a single web page. The host page can be implemented with virtually any technology and can naturally be built with Vaadin Framework, as well. The easiest method is to use the Embedded UI add-on. With it, your code will look something like the following:

VaadinUIComponent ui1 = new VaadinUIComponent("");
VaadinUIComponent ui2 = new VaadinUIComponent("");

VerticalLayout layout = new VerticalLayout(ui1, ui2);

This approach has advantages and disadvantages, as well. You can use the Vaadin API to easily create the mash-up, but with this add-on you’ll have to use the same Vaadin theme and the same Vaadin version in all the applications.

When using this add-on, or manually embedding UIs in HTML, you have to enable Cross Origin Resource Sharing (CORS) in your microservices. The Embedded UI add-on contains helpers to achieve this.


Microservices architectures solve problems in big applications by dividing a system in several microservices implemented, deployed, and run independently. Even when the term “microservices” might be considered a buzzword, I’d suggest embracing it and taking advantage of the modernized techniques that the microservices movement is generating. Even when microservices are used in big systems, you don’t have to be Amazon, Ebay, or Netflix to take advantage of this techniques. I’m working on a hands-on, more down-to-earth, practical guide that shows how to implement a microservices architecture. Stay tuned and be ready to get your hands dirty.

Contact our consultants for help with setting up your microservices project

GitHub transition: completed

Like the most active of you have already noticed, Vaadin has been moving its open source functions to GitHub. Today, we can finally say we are there. Vaadin Framework is the biggest and the most important project to adapt a fully GitHub based workflow.

What does this mean to you?

In short: forget Trac and Gerrit, GitHub is used for everything. This makes participating easier and more familiar for many OSS contributors. The main repositories are now hosted in GitHub and changes are reviewed as basic pull requests. Bug reports and enhancement ideas are now in GitHub as well. The well served Trac service is now in read only state and all existing issues were moved to GitHub.

Our professional services, like Bug Fix Priority, are now also referring to GitHub issues.

Reporting a bug or an enhancement idea

To report a new bug, follow this basic process:

  1. If you don’t have one already, create a GitHub account

  2. Choose the correct project from, e.g. vaadin/framework for Vaadin Framework

  3. Search existing issues as somebody else might have already faced the same issue. If you have more details of the issue, comment on the existing issue. You can also otherwise let the team know the issue is important, by commenting or adding a thumb up emoji or something. You can also subscribe to the issue to be notified about changes in the issue.

  4. If there was no issue yet, create a new one. Add clear details of how to reproduce the issue and attach a reduced test case if possible.

Contributing code

If you want to go a bit further, you can also provide code that fixes bugs or adds cool new features. In that case:

  1. Fork the project of your choice from

  2. Create a pull request, one per fix/feature. Use separate branches for separate changes.

  3. On pull request, ensure you have a contribution licence agreed, the pull request reports this automatically.

  4. Wait for the team to review the changes either directly in GitHub or using Reviewable.

As a summary, participating in any Vaadin project just got much simpler! Individual projects have some more detailed instructions on how to setup development environment and run tests.

Browse Vaadin projects in GitHub

Date-picker gets even better for December

Vaadin Elements has just been updated with improvement to vaadin-date-picker. This update brings some customizability to the element, as well as accessibility and performance improvements.

  • Max and min date limits can now be added with the `min` and `max` properties. Now you’ll never accidentally schedule an event for days gone by.
  • Optional week numbers with the showWeekNumber property. Week numbers are helpful for planning projects or vacations.
  • vaadin-date-picker now supports text input. Type in a date like “10/21/1955” and vaadin-date-picker will use that date.
  • In addition, the text input format is customizable by setting the i18n.parseDate function. Write a custom parsing function or use a library like Sugar to select dates with “today” or “Thursday next week” or “87 years ago”.
date-picker text input enhancement

And lastly, there have also been a few accessibility and performance improvements:

  • Performance has been improved considerably.
  • Screen reader support has been added to improve accessibility. Additionally, if you’ve changed the localization away from English, then the screen reader will read the localized dates.
  • Touch scrolling has been improved.

Enjoy working with the improved vaadin-date-picker. As always, you can ask for questions and support on our forums or Github.

Learn more about installing and using vaadin-date-picker